12 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 10+ items on Envato Market
okanyapici says

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

76 posts
  • Has been part of the Envato Community for over 5 years
  • Has sold $5,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
trimax says

You should cast the Loader object to a MovieClip first and then use the timeline code.

1677 posts Envato Elite Author
  • Has referred 10+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+6 more
Tean says

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”);
}
12 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 10+ items on Envato Market
okanyapici says

Tean I tried your way, but no reaction, no errors… any other comments… i can sed the fla if you want… okan

1246 posts
  • Has referred 50+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Located in Greece
+4 more
zefs says

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.

1677 posts Envato Elite Author
  • Has referred 10+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+6 more
Tean says

Send me the fla if you want, I will take a look.

857 posts
  • Has sold $40,000+ on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has been part of the Envato Community for over 5 years
  • Interviewed on an Envato blog
+5 more
MoeHaydar says

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.

12 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 10+ items on Envato Market
okanyapici says

Hi Tean,

my flas are here :

http://rapidshare.com/files/447837703/fb.rar

thank you very much for your interest

okan

1677 posts Envato Elite Author
  • Has referred 10+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+6 more
Tean says

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');
}

12 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 10+ items on Envato Market
okanyapici says

it does not go to and stop on fame labeled “dene” :(

by
by
by
by
by
by