12 posts
  • Bought between 10 and 49 items
  • Has been a member for 3-4 years
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
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Sold between 5 000 and 10 000 dollars
trimax says

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

1675 posts Envato Elite Author
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Author had a Free File of the Month
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Europe
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
+1 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
  • Bought between 10 and 49 items
  • Has been a member for 3-4 years
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
  • Greece
  • Sold between 5 000 and 10 000 dollars
  • Has been a member for 6-7 years
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 50 and 99 users
  • Bought between 1 and 9 items
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.

1675 posts Envato Elite Author
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Author had a Free File of the Month
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Europe
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
+1 more
Tean says

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

810 posts
  • Has been a member for 5-6 years
  • Interviewed on the Envato Notes blog
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Lebanon
  • Exclusive Author
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
  • Bought between 10 and 49 items
  • Has been a member for 3-4 years
okanyapici says

Hi Tean,

my flas are here :

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

thank you very much for your interest

okan

1675 posts Envato Elite Author
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Author had a Free File of the Month
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Europe
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
+1 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
  • Bought between 10 and 49 items
  • Has been a member for 3-4 years
okanyapici says

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

by
by
by
by
by
by