12 posts
  • Has been part of the Envato Community for over 5 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 6 years
  • Has sold $5,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
trimax
says

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

1688 posts Envato Elite Author
  • Has referred 10+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Became a Top 20 Author of the Month
+8 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 5 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 10+ items on Envato Market
  • Had an item that became a weekly top seller
+5 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.

1688 posts Envato Elite Author
  • Has referred 10+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Became a Top 20 Author of the Month
+8 more
Tean
says

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

890 posts Thinking Big
  • Had an item that was trending
  • Had an item that became a weekly top seller
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $75,000+ on Envato Market and is now an Elite Author
+8 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 5 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

1688 posts Envato Elite Author
  • Has referred 10+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Became a Top 20 Author of the Month
+8 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 5 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