[SWFObject] ExternalInterface and Levels

Aran Rhee aran.rhee at qdc.net.au
Sun Sep 3 02:38:25 PDT 2006


Tim.
 
I think you are just having a targeting issue since you components are
inside a movieClip you are attaching.
 
If you moviclip you are attaching is called "LoaderIMG", then you need to
set the path on the component INSIDE you MC. If your movieClip loader
component instance is called "loader", then you would set its contenpath
like:
 
LoaderIMG.loader.contentPath ="some.jpg"
 
 
again, with the FLV player: if "LoaderFLV" is your MC you are attaching, and
your flv playback component instance is called "playback", set its content
path like:
 
LoaderFLV.playback.contentPath = "some.flv"
 
 
Cheers,
Aran


  _____  

From: swfobject-bounces at lists.deconcept.com
[mailto:swfobject-bounces at lists.deconcept.com] On Behalf Of ReDrUm
Sent: Sunday, 3 September 2006 5:19 PM
To: swfobject at lists.deconcept.com
Subject: [SWFObject] ExternalInterface and Levels


Hi Everyone,
 
This isnt a swfObject specific question so i apologise for that fact but...

I'm trying to build an a flash container swf to perform 2 functions.
 
The First:
To have an image loader using the Loader Component in the hopes of changing
the contentPath via ExternalInterface
 
The Second:
To have a flash video player using the FLVPlayBack Component. Again changing
the contentPath via ExternalInterface
 
My Problem:
I've added the two components to my library, and created two movie clips,
LoaderIMG, and LoaderFLV. Inside each of these MCs is the appropriate
component with a set instance name. I only want one component on the screen
at once. What i want to achieve is the ability to change the content path of
each component externally using the ExternalInterface in Flash 8. Ignoring
the fact that my end goal is to use external interface, in the meantime I am
currently having trouble figuring out how to change the contentPath of the
two loaders. They each only load their origional contentPath values set in
the component instances in the Loader MC's I created. I've been
experimenting with _root, _parent, and _levels but I'm still not having much
luck. If any of you could suggest a fix or an alternative method I would
much appreciate it. 
 
Thanks alot.
 
Actionscript below:
 
// This is a gateway to JavaScript via the ExternalInterface (Do i need two
- one for each function to be called externally?)
var ei1 = flash.external.ExternalInterface.addCallback("loadImages", null,
loadImages); 
var ei2 = flash.external.ExternalInterface.addCallback("loadVideos", null,
loadVideos);

// Temp for development (Its not loading these paths currently which is what
i want to fix)
imgPath = "pics/red.gif";
vdoPath = "media/test2.flv";
trace(imgPath);
trace(vdoPath);

// Function to add the FLVplayer MC to the stage when called upon
function createLoaderFLV ()
{
 // Call our component from the library
 attachMovie("loaderFLV", "loaderFLV", 1);
 // Set its X and Y co-ordinates 
 loaderFLV._x = 0;
 loaderFLV._y = 0;
}

// Function to add our imgLoader MC to the stage when called upon
function createLoaderIMG ()
{
 // Call our component from the library
 attachMovie("loaderIMG", "loaderIMG", 2);
 // Set its X and Y co-ordinates 
 loaderIMG._x = 0;
 loaderIMG._y = 0;
}

// Function to set the contentPath of the images and call createLoaderIMG
function to the stage
function loadImages (imgPath)
{
 // Remove the loaders from the stage
 loaderFLV.removeMovieClip();
 loaderIMG.removeMovieClip ();
 // Creates instances of the loaders on the stage
 createLoaderIMG();
 // Sets the contentPath to that specified externally via php
 imgContainer.contentPath = imgPath;
}

// Function to set the contentPath of the videos and call createLoaderFLV
function to the stage
function loadVideos (vdoPath)
{
 // Remove the loaders from the stage
 loaderIMG.removeMovieClip();
 loaderFLV.removeMovieClip ();
 // Creates instances of the loaders on the stage
 createLoaderFLV();
 // Sets the contentPath to that specified externally via php
 vdoContainer.contentPath = vdoPath;
 // Plays the file once loaded
 vdoContainer.play();
}

// Loads the Images or Videos inside their loaders on the stage, start with
Images
loadImages(imgPath);
//loadVideos(vdoPath);

 
Thanks again to anyone who can help,

Tim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.deconcept.com/pipermail/swfobject-deconcept.com/attachments/20060903/8705d29e/attachment-0005.htm>


More information about the Swfobject mailing list