Nessuno mi può dare qualche dritta???? Che sia un problema di debug??? Perchè ho provato su diversi pc e browser ed il problema non l'ho riscontrato! Ma, lavorando nel .fla si, sempre. Mi da errore!!!!
:(
This is a discussion on Problema con un modulo news scroll su swf esterno within the Flash CS4 forums, part of the Flash Italiano category; Ciao a tutti, sono nuovo, anzi nuovissimo su questa fantastica community. Volevo farvi una domanda che mi sta facendo impazzire ...
Ciao a tutti, sono nuovo, anzi nuovissimo su questa fantastica community.
Volevo farvi una domanda che mi sta facendo impazzire oggi, è la seguente:
sto realizzando un sito con Flash CS4 in AS3, non sono molto pratico, ma diciamo che qualcosa riesco a fare con l'AS. Il mio sito è così articolato: main.swf (filmato principale) che carica al suo interno home.swf (che a sua volta carica ---> un clip con immagini di sfondo che cambiano -cliphome.swf- ed un modulo news -news.swf- con scroll contentente testo ed immagini tramite XML + file AS esterno. Gli altri pulsanti caricano altri swf come ad esempio galleria.swf, prodotti.swf... ecc. ecc.
Il problema però è relativo allo scroll presente nelle news, prima che lo inserissi e settassi, andava tutto ok ed il sito (on-line) non mi dava nessun errore, ora col modulo inserito flash mi da errore di output:
TypeError: Error #1009: Impossibile accedere a una proprietà o a un metodo di un riferimento oggetto null.
at news_fla::news_4/stopScroll()
Quindi, ricapitolando, nel main.swf ho questo codice:
e non ho nessun problema.PHP Code:this.stop();
//caricamento swf esterni
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.MouseEvent;
var addedDefinitions1:LoaderContext = new LoaderContext();
addedDefinitions1.applicationDomain=ApplicationDomain.currentDomain;
var loader1:Loader = content_mc.addChild(new Loader()) as Loader;
loader1.load(new URLRequest("home.swf"), addedDefinitions1);
pulsHome_btn.addEventListener(MouseEvent.MOUSE_UP,menuRelease);
pulsFrantoio_btn.addEventListener(MouseEvent.MOUSE_UP,menuRelease);
pulsProdotti_btn.addEventListener(MouseEvent.MOUSE_UP,menuRelease);
pulsTerritorio_btn.addEventListener(MouseEvent.MOUSE_UP,menuRelease);
pulsLavorazione_btn.addEventListener(MouseEvent.MOUSE_UP,menuRelease);
pulsContatti_btn.addEventListener(MouseEvent.MOUSE_UP,menuRelease);
function menuRelease(e:Event):void {
var swfFile;
if (e.target.name=="pulsHome_btn") {
swfFile="home.swf";
} else if (e.target.name == "pulsFrantoio_btn") {
swfFile="pages/frantoio.swf";
} else if (e.target.name == "pulsProdotti_btn") {
swfFile="pages/prodotti.swf";
} else if (e.target.name == "pulsTerritorio_btn") {
swfFile="pages/territorio.swf";
} else if (e.target.name == "pulsLavorazione_btn") {
swfFile="pages/lavorazione.swf";
} else if (e.target.name == "pulsContatti_btn") {
swfFile="contatti.swf";
} else {
trace("error");
}
loader1.load(new URLRequest(swfFile), addedDefinitions1);
}
Nella home.swf ho questo:
Questo mi serve per caricare nel main i due clip video esterni dove uno ha la slide di immagini in loop e l'altro appunto... le benedette news che mi danno problemiPHP Code:this.stop();
var swf1:MovieClip;
var loader1:Loader = new Loader();
var defaultSWF1:URLRequest = new URLRequest("cliphome.swf");
loader1.load(defaultSWF1);
addChild(loader1);
loader1.x=0;
loader1.y=0;
var swf2:MovieClip;
var loader2:Loader = new Loader();
var defaultSWF2:URLRequest = new URLRequest("news.swf");
loader2.load(defaultSWF2);
addChild(loader2);
loader2.x=0;
loader2.y=244;
Questo invece è il codice di news.swf
Ragazzi io vi ringrazio anticipatamente per le risposte che mi darete!!!!PHP Code:import gs.TweenLite;
import fl.motion.easing.*;
import fl.transitions.*;
import fl.transitions.easing.*;
//masks
scrlCnt.mask = scrlMsk;
//*************** XML ***************//
//on news.xml load
function onNewsXMLLoad(event:Event):void {
var newsXML:XML = new XML(event.target.data);
newsXML.ignoreWhitespace = true;
for (var i:int = 0; i<newsXML.item.length(); i++) {//videos
var tileNews:Tile = new Tile();
tileNews.x = tileNews.width*i+10*i;//10 = spacing between the news tiles
//video date+name and description+link
tileNews.nameTxt.htmlText = newsXML.item[i].date.text()+" - "+newsXML.item[i].name.text();
tileNews.infoTxt.htmlText = newsXML.item[i].txt.text()+" <font color='#FFFFFF'><a href='"+newsXML.item[i].linkurl.text()+"'>"+newsXML.item[i].linkname.text()+"</a></font>";
//thumbnail
var imgLoader:Loader = new Loader();
imgLoader.load(new URLRequest(newsXML.item[i].thumbnail.text()));
imgLoader.x = 17//horizontal position of the thumbnail
imgLoader.y = 11//vertical position of the thumbnail
tileNews.addChild(imgLoader);
scrlCnt.addChild(tileNews);
}
}
var newsXMLLoader:URLLoader = new URLLoader();
newsXMLLoader.addEventListener(Event.COMPLETE, onNewsXMLLoad, false, 0, true);
newsXMLLoader.load(new URLRequest("news.xml"));//load news from news.xml
//*************** Functions ***************//
/*** Scrollbar ***/
//on click, start scrolling
function startScroll(event:MouseEvent):void {
scrlDrg.startDrag(false, new Rectangle(scrlTrack.x+10, scrlTrack.y-3.5, scrlTrack.width-scrlDrg.width-20, 0));
TweenLite.to(scrlCnt, 0.5, {y:"0", ease:Regular.easeOut});
stage.addEventListener(Event.ENTER_FRAME, scrollGo, false, 0, true);
}
//on mouse up, stop scrolling
function stopScroll(event:MouseEvent):void {
stopDrag();
stage.removeEventListener(Event.ENTER_FRAME, scrollGo);
}
//move the news
function scrollGo(event:Event):void {
TweenLite.to(scrlCnt, 0.5, {x:Math.round(scrlTrack.x+10-10-(scrlCnt.width-(scrlTrack.width+40-scrlDrg.width))*((scrlDrg.x-scrlTrack.x-10)/(scrlTrack.width-20-scrlDrg.width))), ease:Regular.easeOut});
}
//on mouse wheel, scroll
function onScrollWheel(event:MouseEvent):void {
var newY:Number = scrlDrg.x-event.delta*20;
if (newY>=scrlTrack.x+10 && newY<=scrlTrack.x+10+(scrlTrack.width-scrlDrg.width-10)) {
scrlDrg.x -= event.delta*20;
}
TweenLite.to(scrlCnt, 0.5, {x:Math.round(scrlTrack.x+10-10-(scrlCnt.width-(scrlTrack.width+40-scrlDrg.width))*((scrlDrg.x-scrlTrack.x-10)/(scrlTrack.width-20-scrlDrg.width))), ease:Regular.easeOut});
}
//*************** Events ***************//
stage.addEventListener(MouseEvent.MOUSE_WHEEL, onScrollWheel, false, 0, true);
scrlDrg.addEventListener(MouseEvent.MOUSE_DOWN, startScroll, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, stopScroll, false, 0, true);
Ciao
Simone
Nessuno mi può dare qualche dritta???? Che sia un problema di debug??? Perchè ho provato su diversi pc e browser ed il problema non l'ho riscontrato! Ma, lavorando nel .fla si, sempre. Mi da errore!!!!
:(
Ragazzi niente??? Nessuno sa dirmi come integrare questo codice???? NIENTE!!!!!
FLEEEEEEEEEP!
Help!!!!
![]()
Bookmarks