A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: How to access functions in external swfs?

  1. #1
    Senior Member
    Join Date
    Mar 2007
    Posts
    133

    How to access functions in external swfs?

    Hey guys, just wondering how actionscript 3.0 deals with accessing functions in external swfs?

    In actionscript 2 i would just load the external swf into a movieclip (eg: loader_mc) then i would just say loader_mc.animateIn().

    I've tried the same thing in AS3 but it doesnt work... Can anyone tell me the new way of doing it?

    Thx

  2. #2
    Senior Member
    Join Date
    Mar 2007
    Posts
    133
    ^bump

  3. #3
    Member
    Join Date
    May 2004
    Location
    Snyder, TX, US
    Posts
    34
    Do you want to load the swf and call one of its methods or just call one of its methods?
    You don't sell the steak...you sell the sizzle!

    My outdated website.

  4. #4
    Senior Member Sietjp's Avatar
    Join Date
    Jan 2005
    Location
    Paris, France
    Posts
    711
    You have to use LocalConnection class. Make a search on this keyword on google there are some tutorials out there.

  5. #5
    Senior Member
    Join Date
    Mar 2007
    Posts
    133
    Thx for the replies. Im checking out this LocalConnection class but it seems a bit strange. Basically i've already loaded the swf into a movieclip, all i want to do is to call a function called animateIn() which is in the swf i loaded into the movieclip.

    Normally it would just be blah_mc.animateIn(). I dont c why they changed it...

  6. #6
    Junior Member
    Join Date
    Sep 2007
    Posts
    15
    Code:
    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadCompleteHandler);
    loader.load(new URLRequest('myMovie.swf'));
    
    function loadCompleteHandler(event:Event):void
    {
    	var movie:* = loader.content;
    	movie.animateIn();
    }

  7. #7
    Member
    Join Date
    May 2004
    Location
    Snyder, TX, US
    Posts
    34
    If you are loading an AS2 swf, you will need to use something like http://www.gskinner.com/blog/archive...dge_easie.html
    You don't sell the steak...you sell the sizzle!

    My outdated website.

  8. #8
    Senior Member
    Join Date
    Mar 2007
    Posts
    133
    Sweet thx 2morrowMan. I'll try it out today.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center