Hi Friends,
I am trying to get a simple function. On first frame of the main time line, code below :
stop(); var myLoader:Loader = new Loader(); addChild(myLoader); var url2:URLRequest = new URLRequest(“fb_ALL.swf”); myLoader.load(url2); myLoader.x=0 myLoader.y=0
loads an external swf called “fb_ALL.swf”
than loaded swf plays and when it reaches to its last frame, code below :
MovieClip(root).gotoAndStop(“dene”);
should take the maintimeline to the frame labeled “dene”.
But it does not… 
“cannot convert flash.display::Loader to flash.display.MovieClip.” is the error message i get.
Any help will be appreciated.
Best wishes
Okan
You should cast the Loader object to a MovieClip first and then use the timeline code.
- Sold between 50 000 and 100 000 dollars
- Author was Featured
- Author had a Free File of the Month
- Exclusive Author
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Europe
- Has been a member for 3-4 years
- Referred between 10 and 49 users
The best would be to use events:
in your child swf:
function onLastFrame():void {
dispatchEvent(new Event("lastFrameEvent"));
}
in your parent swf:
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
function loaded(e:Event):void {
myLoader.content.addEventListener("lastFrameEvent", onLastFrame);
}
function onLastFrame(e:Event):void {
gotoAndStop(“dene”);
}
Tean I tried your way, but no reaction, no errors… any other comments… i can sed the fla if you want… okan
- Greece
- Sold between 5 000 and 10 000 dollars
- Has been a member for 5-6 years
- Author was Featured
- Exclusive Author
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Referred between 50 and 99 users
- Bought between 1 and 9 items
Upload the fla somewhere and give us the link or send it to me via email, I have some spare time to check it out right now.
- Sold between 50 000 and 100 000 dollars
- Author was Featured
- Author had a Free File of the Month
- Exclusive Author
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Europe
- Has been a member for 3-4 years
- Referred between 10 and 49 users
Send me the fla if you want, I will take a look.
Tean said
The best would be to use events:in your child swf: function onLastFrame():void { dispatchEvent(new Event("lastFrameEvent")); } in your parent swf: myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded); function loaded(e:Event):void { myLoader.content.addEventListener("lastFrameEvent", onLastFrame); } function onLastFrame(e:Event):void { gotoAndStop(“dene”); }
best practice. I had some problem with this when i tried timeline animation and found this a wonderful solution.
Hi Tean,
my flas are here :
http://rapidshare.com/files/447837703/fb.rar
thank you very much for your interest
okan
- Sold between 50 000 and 100 000 dollars
- Author was Featured
- Author had a Free File of the Month
- Exclusive Author
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Europe
- Has been a member for 3-4 years
- Referred between 10 and 49 users
put this in loaded on last frame:
stop();
dispatchEvent(new Event("lastFrameEvent"));
put this in main on first frame:
stop();
var myLoader:Loader = new Loader();
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
var url2:URLRequest = new URLRequest("fb_ALL.swf");
myLoader.load(url2);
function loaded(e:Event):void {
myLoader.content.addEventListener("lastFrameEvent", onLastFrame);
addChild(myLoader);
}
function onLastFrame(e:Event):void {
gotoAndStop('dene');
}
it does not go to and stop on fame labeled “dene” 
