PDA

View Full Version : Flex 1 Swf Loader, multiple swfs importing from shared library



AzureRain
December 15th, 2009, 09:24 PM
Hi everyone,

I'm using Flex builder 3 for my main application (web-based), and I need to load multiple swf files built in flash cs4 (AS3) at different times. The flash swfs import assets from a separate flash swf used as a shared library. I'm using 1 swf loader in flex to keep 1 flash swf loaded at a time.

Loading the first swf works fine, but loading subsequent swfs generates an error in importing from the shared library swf.

Here's an example of an error:
"ReferenceError: Error #1065: Variable sharedApps is not defined."

Thanks in advance for any advice!

AzureRain
December 17th, 2009, 02:16 AM
bump! Shared library references can only be used once!

felix3000
December 21st, 2009, 05:06 PM
I think this is the same thing i am trying to do. I have a code for AS2 and am looking to make it in AS3 as a few of the swf files I am loading use cs4 AS3 components.

var swfs = ["reel1.swf","reel2.swf","reel6.swf"];
var currentMovie = 0;

_root.createEmptyMovieClip("clip",0);

_root.clip.loadMovie(swfs[currentMovie]);
_root.onEnterFrame = checkLoadFinish;

function checkLoadFinish() {
if ((_root.clip.getBytesTotal() > 4) && (_root.clip.getBytesLoaded() >= _root.clip.getBytesTotal())) {
delete _root.onEnterFrame;
_root.clip.onEnterFrame = checkPlayFinished;
}
}

function checkPlayFinished() {
if (this._currentframe == this._totalframes) {
//this.stop();
currentMovie = (currentMovie+1)%swfs.length; //goes from 0 to 2 and back to 0
_root.clip.loadMovie(swfs[currentMovie]);
delete this.onEnterFrame;
_root.onEnterFrame = checkLoadFinish;
}
}

Can anyone translate that into AS3?

Matt Garland
January 21st, 2010, 06:28 PM
EXACT same problem--can only use a shared library symbol once in a CS4 swf then I get to the 1065 error.

Did you ever solve this?