[SWFObject] SWFObject Vol 6 Issue 3 - ExternalInterface and Levels (ReDrUm)

Tim Keir tim at timkeir.com
Sun Sep 3 20:37:56 PDT 2006


That helped thanks, The targeting has been solved however I'm still having
trouble setting the contentPath initially from within my function.

I have a movieClip in my library called loaderIMG
inside loaderIMG i have an instance of the loader component from my library,
given the instance name imgContainer. This instance has been given a default
contentPath of "pics/default.jpg" then in my _root timeline i have this
function:

function loadImages (imgPath)
{
createLoaderIMG(); //function to add loaderIMG to the stage
loaderIMG.imgContainer.contentPath = imgPath;
}
loadImages("pics/photo1.jpg"); // Should change the contentPath to that

so its adding the movieclip to the stage with the default contentPath as it
should,

but then its not changing it to the specified.

if i create a button and set:

on (release) { loaderIMG.imgContainer.contentPath = "pics/photo1.jpg"; }

then it changes the contentPath but i want to be able to change it initially
when the function is called.

Any more help please?

Thanks alot,

Tim


Message: 3
Date: Sun, 3 Sep 2006 19:38:25 +1000
From: "Aran Rhee" <aran.rhee at qdc.net.au>
Subject: Re: [SWFObject] ExternalInterface and Levels
To: <swfobject at lists.deconcept.com>
Message-ID: <000d01c6cf3c$bb78a070$0300a8c0 at HYPERION>
Content-Type: text/plain; charset="us-ascii"

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/20060904/6bc4cc91/attachment-0004.htm>


More information about the Swfobject mailing list