Author Message

Posted: Mon Jul 28, 2008 6:41 pm   Post subject: Loading another swf

Hi,

Started using the Flex SDK and loving it.

Writing on an Adobe AIR application and having problems with getting multiple swf's to load.

I successfully get "presentation A" to load, but when I try to load "presentation B" instead of "presentation A" nothing shows.

Can anyone please help with code examples or suggested readings?

Thank you / Martin


Profile profile test

Posted: Mon Jul 28, 2008 9:10 pm   Post subject:

Got it working... May not be the cleanest approach but it works thus far.

Made a change in: C:\Program Files\iSpring Ultra 3\samples\samples\as3bridge\CAS3Bridge.as

/* Added */
private var thaTarget:MovieClip;
/* end added */

public function CAS3Bridge(target:MovieClip, presentationURL:String, commandConnectionName:String, eventConnectionName:String)
{
/* Added */
thaTarget = target;
/* end added */

[original code here]

}

/* Added */
public function loadPresentation( m_presentationURL:String ) : Void
{
m_presentationLoader.unloadClip();
m_sendPresentationInfo = new Object();
m_sendSlidesInfo = new Array();
m_mcPresentation = thaTarget.createEmptyMovieClip("m_mcPresentation", target.getNextHighestDepth());
m_presentationLoader = new CPresentationLoader();
m_presentationLoader.setPlayerListener(this);
m_presentationLoader.addListener(this);
if (m_presentationURL == undefined)
m_presentationURL = "#";
m_presentationLoader.loadClip(m_presentationURL, m_mcPresentation);
}
/* end added */

Then, in the app code I call "loadPresentation('theOtherSwf.swf')" to have the as3bridge load a different swf.

loadPresentation


Profile profile test

Posted: Wed Sep 17, 2008 4:02 pm   Post subject: Loading another swf

Dear Martin,

Can you please give me some more information on how exactly you include this code into your Flex project and where you call the new "loadPresentation" function. Best would be a little downloadable tutorial ;-)

Thanks in advance
Peter


Profile profile test

Posted: Thu Aug 12, 2010 5:53 am   Post subject: Re: Loading another swf

var loader:MovieClipLoader = new MovieClipLoader();
var loadHandler:Object = new Object();
loader.addListener(loadHandler);
bar_mc._xscale = 0;

// define what should happen when the jpg/swf is completely loaded
// use _mc to refer to the loaded jpg/swf
loadHandler.onLoadInit = function(_mc:MovieClip) {
bar_mc._visible = false;
};

// define what should happen while the jpg/swf is loading
// use _mc to refer to the jpg/swf and loaded & total to refer to the number of bytes
// currently loaded and to be loaded, respectively
loadHandler.onLoadProgress = function(_mc:MovieClip, loaded:Number, total:Number) {
bar_mc._xscale = loaded / total * 100;
};

// start loading specified jpg/swf into blank movieclip holder_mc on stage
loader.loadClip("game.swf", holder_mc);

try that one..
______________________
guild wars 2 gold


Profile profile test
Display posts from previous:  Sort by  

  


Who is online
Who is online In total there are 6 users online :: 1 registered, 0 hidden and 5 guests (based on users active over the past 5 minutes)
Most users ever online was 108 on Thu Nov 21, 2013 3:41 pm

Registered users: Bing [Bot]