Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Using MovieClipLoader.loadClip()



say I have

code: mc.loadMovie("http://someurl.com/somepic.jpg")
playnow=true;

How would I use MovieClipLoader.loadClip() to add a listener, so I can invoke playnow only after the clip has loaded? I couldn't figure out how you reference the movie.



FlashKit > Flash Help > Flash ActionScript
Posted on: 04-14-2004, 10:29 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Can AS3 .swf MovieClipLoader.loadClip(AS2.swf);
Hey I'm new to AS3.

I'm makeing a Interface and i'd like to use AS3.
If the interface is in AS3 can i use MovieClipLoader to load in AS2 files?

Another thing in the AS2 file that i'll be loading in there are function calls to the main time line. e.g.
_level0.functionName(sameVar);
Will this simply call a function from the AS3 interface??


Tips and links to making the move would be appreciated.

Thanks Baz.

BUG? - MovieClipLoader.loadClip()
I've developed an app. in MX2004 which uses the MovieClipLoader.loadClip() method and the loadInit listener. I have tested the script with success in the IDE. However when I run the .swf via the web I encounter mixed results. I should note that that I have tested using both absolute and relative paths for the "url" parameter and have had the same results regardless.

Is this a know bug in MX2004? Is there any solid documentation from Macromedia regarding this issue? I have not been able to find it if so. Any help would be greatly appreciated. Thanks!

simple sample:

http://endologik.com/dev/loadClip

Fails to load image on:
PC's-
IE 6
Mozilla

Mac OSX-
Mozilla
Safari

Succeeds to load image on
Mac OSX-
IE 5.2.3
Opera
Omni Web

sample's script:

// BUTTON EVENT =======================================
btn_mc.onPress = function()
{
my_mcl.loadClip('images/aquatics01.jpg', 'images_mc');
};
// LISTENERS ==========================================
var my_mcl:MovieClipLoader = new MovieClipLoader();
var loadListener:Object = new Object();
loadListener.onLoadInit = function(target_mc)
{
display.text = target_mc + ' was loaded';
};
my_mcl.addListener(loadListener);
//======================================================

BUG? - MovieClipLoader.loadClip()
I've developed an app. in MX2004 which uses the MovieClipLoader.loadClip() method and the loadInit listener. I have tested the script with success in the IDE. However when I run the .swf via the web I encounter mixed results. I should note that that I have tested using both absolute and relative paths for the "url" parameter and have had the same results regardless.

Is this a know bug in MX2004? Is there any solid documentation from Macromedia regarding this issue? I have not been able to find it if so. Any help would be greatly appreciated. Thanks!

simple sample:

http://endologik.com/dev/loadClip

Fails to load image on:
PC's-
IE 6
Mozilla

Mac OSX-
Mozilla
Safari

Succeeds to load image on
Mac OSX-
IE 5.2.3
Opera
Omni Web

sample's script:

// BUTTON EVENT =======================================
btn_mc.onPress = function()
{
my_mcl.loadClip('images/aquatics01.jpg', 'images_mc');
};
// LISTENERS ==========================================
var my_mcl:MovieClipLoader = new MovieClipLoader();
var loadListener:Object = new Object();
loadListener.onLoadInit = function(target_mc)
{
display.text = target_mc + ' was loaded';
};
my_mcl.addListener(loadListener);
//======================================================

Problems With MovieClipLoader.loadClip()
Hello. I am having issues with loading SWFs through the MovieClipLoader.

Here is the general setup:

• MovieClip object with 1) preloader and 2) container for video. Is passed a parameter to find the content to load.
• Using MovieClipLoader and its events, loads a SWF into the empty container displaying preloader until loaded and then stops and waits for transport controls on _root to do its thing.

PROBLEM: Works fine at loading the clip, but the dimensions of the video container are not the size that I was expecting; the clip displays larger. The container object, as well as the source SWF, are setup to be the same size.

SIDE PROBLEM: Trying to see if the preloader in the MovieClip actually works given it does not appear onLoadProgress fires.

As for the project itself:

• clips that I am loading are relatively large. Compressed as much as I can for quality and embedded within the SWF range from ~4MB to ~46MB. As such, I obviously want to load on demand rather than embed the movies.
• All videos represent the same time series. However, they do not sync. As such, I need to be able to control the videos through ActionScript in order to specify the frame to show in an arbitrary number of slave movies based upon the position of the master clip.
• In addition, I need to be able to duplicate the clip and run simultaneous to the first clip, but at a different start position, e.g., one starts at 9:00am, the other at 12:00pm.

Help on the sizing issue; as well as any comments, pointers, or examples on the construct of this Flash; are greatly appreciated.

MovieClipLoader.loadClip(URL,mc) Issue
Hi,

I have just migrated from Flash MX /Actionscript 1.0 to Flash 8/Actionscript 2.0 and started to replace mc.loadMovie() with mcl.loadClip() in my programs mainly because i want to take advantage of the preloading listeners etc. in the MovieClipLoaderClass

I have come across one issue which is driving me insane!

i am reading in an XML file which contains a list of paths to images i want to load in. For example:

<image> images/category1/01.jpg </image>
<image> images/category1/02.jpg </image>
<image> images/category2/01.jpg </image> etc..

and i store these paths in an array called imageArray

now using actionscript 1.0 in flash mx i would write something like

mc.loadmovie(imageArray[0]) and my image would load.

using ActionScript2.0 in flash 8 i write

mcl.loadClip(imageArrray[0],mc) and the image DOES NOT load.

if i change the line to read

mcl.loadClip(""+imageArrray[0]+"",mc) then the image loads

Why is this necessary? imageArray[0] is already a string why do i need to ad quotes to it for the MovieClipLoder class? Am i missing something obvious?

thanks in advance

Andy

MovieClipLoader.loadClip Not Working?
Hi,

I have this following function..



Code:

function addImageElement(p_mc:MovieClip, imgName:String, elName:String){

c_mc=p_mc.createEmptyMovieClip(elName, p_mc.getNextHighestDepth());
var mapl:MovieClipLoader = new MovieClipLoader();
mapl.loadClip(imgName, c_mc);

}

...that works like a charm in FP8.

But in FP7 it refuses to load the images.

What's wrong? I can't find any info under help.

Best,
NoBuzz

MovieClipLoader LoadClip And UnloadClip
When I call unloadClip on a MovieClipLoader instance after loading has started, but before loading finishes, the clip continues loading. Is there any kind of "stop()" functionality for the MovieClipLoader?

I have a main image viewer tied to button events that tell it to load the next or previous image. So if the user clicks the next button 10 times, the MovieClipLoader instance will load all 10 clips, rather than dumping the UrLs sent by the previous 9 clicks. I know I can just disable the buttons until the data has loaded, but that shouldn't be necessary.

I've tried these workarounds with no success:
- Re-initializing the moviecliploader instance I am using when either button is clicked
- Deleting the target movie of the previous load, and putting the new target on another level with a different name

I thought about setting the _alpha property of the targets of previous load requests to 0, but that still means that the user has to wait for each image to download before they get to the one they wanted. So they don't see the clips loading but they have to wait alot longer.

I haven't found much help on the forums for this, or the documentation. So, I assume it's still possible to halt the loading of data with moviecliploader as I have not come across any site that says "You must wait for the load to finish before calling unloadClip()". The documentation says that unloadClip during loading should trigger onLoadError, but it doesn't -- someone made mention of this in the user comments section but I haven't seen a response to it.
http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00001584.html
http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002538.html

Thanks in advance for any help. Even if it's to tell me that you can't stop loading a file mid-stream.

MovieClipLoader LoadClip Not Working
Code:
this.createEmptyMovieClip('test', this.getNextHighestDepth());
var pics:Array = new Array();
pics[0] = '1.jpg';
pics[1] = '2.jpg';
pics[2] = '3.jpg';
pics[3] = '4.jpg';
pics[4] = '5.jpg';
for ( i = 0; i < pics.length; i++ ){
pic_cont = _root.test.createEmptyMovieClip('pic'+i, this.getNextHighestDepth());
pic_cont._x = 10*i;
pic_cont._y = 10*i;
var img:MovieClipLoader = new MovieClipLoader();
var list:Object = new Object();
img.addListener(list);
list.onLoadStart = function(){
trace("Load started.");
}
list.onLoadError = function(){
trace("Error");
}
img.loadClip( pics[i], 'test.pic'+i);
delete img, list;
}
Won't work and I can't figure out whats wrong with it. If I trace img.loadClip( pics[i], 'test.pic'+i); it returns false. But the error function never get's called. Any idea what i'm doing wrong?

EDIT: I've got it working, the code is the code i'm using that works, but all of the images stack on top of each other. I can't figure out how to fix this.

[AS2] MovieClipLoader LoadClip Failure
I'm having a fun little bug with the loadClip function of the MovieClipLoader class. I've passed it a valid MovieClip and a valid filename (verified by traces) and it still returns false. It never calls the listener object I created with a onLoadStart or onLoadError event. I'm still trying to figure out why it would return false, but I'm at a loss. It had worked before and I changed something, but I can't remember what. I've looked it over a few times and I figure I might need a second eye to see what might be wrong here...


Code:
import mx.events.EventDispatcher;
import mx.utils.Delegate;

class MultiSWFManager_MiniLoader {
public var dispatchEvent:Function;
public var addEventListener:Function;
public var removeEventListener:Function;
private var _loader:MovieClipLoader;
private var _listener:Object;
private var _progressBar:MovieClip;
private var _mc_target:MovieClip;
private var _file:String;
private var _scale:Number;
private var _percent:Number;

function MultiSWFManager_MiniLoader(file:String, target:MovieClip) {
_loader = new MovieClipLoader();
_listener = new Object();
_file = new String(file);
_scale = new Number(1);
_percent = new Number(0);
_mc_target = target;
EventDispatcher.initialize(this);
}

public function beginLoad() {
if (_percent == 0) {
trace('Loading ' + this._file + ' into ' + this._mc_target);
_percent = 0.0001;
_listener.onLoadStart = function(mc:MovieClip) { trace(mc + " started..."); }// Delegate.create(this, onLoadStart);
_listener.onLoadError = Delegate.create(this, onLoadError);
_listener.onLoadProgress = Delegate.create(this, onLoadProgress);
_listener.onLoadComplete = Delegate.create(this, onLoadComplete);
_listener.onLoadInit = Delegate.create(this, onLoadInit);
_loader.addListener(this._listener);
trace(_loader.loadClip(_file, _mc_target));
_mc_target._visible = false;
}
}

private function onLoadStart(mc:MovieClip) {
trace(mc + " started...");
}

private function onLoadError(mc:MovieClip, errorCode:String, httpStatus:Number) {
trace(mc + " error: " + errorCode + " (" + httpStatus + ")");
}

private function onLoadProgress(mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
_percent = (bytesLoaded / bytesTotal) * 100;
_progressBar._xscale = (_scale * _percent) * .98;
}

private function onLoadComplete(target_mc:MovieClip, httpStatus:Number) {
trace("Status: " + httpStatus);
}

private function onLoadInit(mc:MovieClip) {
trace(' Inited ' + this._file);
dispatchEvent ({type:"complete"});
mc._visible = false;
}
}
Traces:

Code:
Loading test1.swf into _level0.mc_container2
false
It never calls onLoadStart (I figured it might be a scope issue, so I placed the function inline. Otherwise, I created private functions for each event.)

LoadClip Problems (MovieClipLoader)
Hi guys...
I'm having some trouble with loadClip.
Im loading some external JPGS with loadClip.


ActionScript Code:
var my_mcl = new MovieClipLoader();
myListener = new Object();
 
myListener.onLoadInit = function(target_mc) {
 // some code here when image load is complete like resizing.. etc...
 
}
my_mcl.addListener(myListener);
my_mcl.loadClip(imgPath, _root.contentMC);


well.. everything seems ok, the image loads ok...
I noticed after puting the flash on my webpage that in all browsers that i've tried, (IE6+, firefox, opera) the statusbar is allways loading.. this is... all my page is fully loaded and on the status bar appear this message: "Transfering data from www.sample.com" when it should appear Done.


I thought that was a problem with my code, so i was checking other websites that have samples with loadClip, and all those had the same problem.. "Transfering data from www.sample.com"


Does anyone know why this is happen!? is this a flash bug with movieClipLoader, security issues?

Best regards,
Bruno

MovieClipLoader.loadClip And Query Strings
Hi,

I'm using Actionscript 2.0, and I'm trying to pass a query parameter in the url portion of MovieClipLoader.loadClip, e.g.

mcLoader.loadClip("movie1.swf?param=1234", blahblah);

but got the error "URLNotfound". If I omit "?param=1234", then it works.

I need to put clip loading inside a class definition, so when I tried to use MovieClip.loadMovie, I find difficult to correctly setup the event handlers "onClipEvent(load)" or even worse with "onLoad". Any ideas?

Thanks!

Ben

MovieClipLoader.loadClip And Query Strings
Hi,

I'm using Actionscript 2.0, and I'm trying to pass a query parameter in the url portion of MovieClipLoader.loadClip, e.g.

mcLoader.loadClip("movie1.swf?param=1234", blahblah);

but got the error "URLNotfound". If I omit "?param=1234", then it works.

I need to put clip loading inside a class definition, so when I tried to use MovieClip.loadMovie, I find difficult to correctly setup the event handlers "onClipEvent(load)" or even worse with "onLoad". Any ideas?

Thanks!

Ben

MovieClipLoader's LoadClip Method Is Loading Swf Before Its Downloaded 100%?
Hello everyone,

I created a MovieClipLoader a few days ago that is reuseable. I will be using the same preloader graphics when I am loading in external swf on my stage. My MovieClipLoader functions fine with jpegs and smaller sized swf files. But whenever I load a larger sizes swf it loads the movie before it has fully downloaded in simulation mode. The odd part is that everything works fine with smaller swf files but not larger ones . I have tested a few movies and that seems to be the common theme.

In the example below main.swf is the clip I am loading into "mcBackground".

var mclTV : MovieClipLoader = new MovieClipLoader ();
var loadListener : Object = new Object ();
// events it will handle
loadListener.onLoadStart = function ()
{
trace ("onLoadStart");
trace (this._target);
progress_mc._y == 268;
txtLoaded._visible = true;
progress_mc._visible = true;
};
loadListener.onLoadProgress = function (target : MovieClip, bytesLoaded : Number, bytesTotal : Number)
{
txtLoaded.text = String (Math.floor (bytesLoaded / bytesTotal * 100)) + "% loaded";
progress_mc._xscale = bytesLoaded / bytesTotal * 100;
};
loadListener.onLoadComplete = function ()
{
trace ("onLoadComplete");
txtLoaded._visible = false;
progress_mc._visible = false;
};
mclTV.addListener (loadListener);
mclTV.loadClip ("main.swf", mcBackground); //mcBackground is an empty movieClip on the stage
txtLoaded._visible = false;
progress_mc._visible = false;

Problems With Variables & MovieClipLoader.loadClip() Function.
Hello,

I'm making a XML photogallery. Im using a MovieClipLoader to load multiple images on the screen at the same time.

I've assigned variable path to hold image[p].childNodes which returns gallery/051102.jpg.
eg. path = image[p].childNodes;
trace(path); //returns gallery/051102.jpg

so when I load the image into the MovieClipLoader,
eg. mcLoader.loadClip(path, image);
no images show up.

if i subsitute path with,
eg. mcLoader.loadClip("gallery/051102.jpg", image);
image gallery/051102.jpg shows up!

Any help is appreciated. Thank you.
irok

MovieClipLoader.loadClip Doesn't Work, But MovieClip.loadMovie Does?
ActionScript Code:
private function init()
{
    var mclLoader:MovieClipLoader = new MovieClipLoader();
    var objLoadListen:Object = new Object();
    var mcTarget:MovieClip = _mcParent.createEmptyMovieClip("_mcGraphic" + _nCounter.toString(), _mcParent.getNextHighestDepth());
   
    /*objLoadListen.onLoadStart = Delegate.create(this, onLoadStart);
    objLoadListen.onLoadProgress = Delegate.create(this, onLoadProgress);
    objLoadListen.onLoadComplete = Delegate.create(this, onLoadComplete);*/
    objLoadListen.onLoadInit = Delegate.create(this, onLoadInit);
   
    //mcTarget.loadMovie(_strFile);    //This Works...
   
    mclLoader.addListener(objLoadListen);
    mclLoader.loadClip(_strFile, mcTarget);    //This Doesn't...
}

Code is pretty simple...for some reason the loadMovie statement processes fine, but the loadClip statement does not. No error, no nothing...it just doesn't load the image.

MovieClipLoader's LoadClip Method Is Loading Swf Before Its Downloaded 100%? (Smack)
Hello everyone,

I created a MovieClipLoader a few days ago that is reuseable. I will be using the same preloader graphics when I am loading in external swf on my stage. My MovieClipLoader functions fine with jpegs and smaller sized swf files. But whenever I load a larger sizes swf it loads the movie before it has fully downloaded in simulation mode. The odd part is that everything works fine with smaller swf files but not larger ones . I have tested a few movies and that seems to be the common theme.

In the example below main.swf is the clip I am loading into "mcBackground".


Code:
var mclTV : MovieClipLoader = new MovieClipLoader ();
var loadListener : Object = new Object ();
// events it will handle
loadListener.onLoadStart = function ()
{
trace ("onLoadStart");
trace (this._target);
progress_mc._y == 268;
txtLoaded._visible = true;
progress_mc._visible = true;
};
loadListener.onLoadProgress = function (target : MovieClip, bytesLoaded : Number, bytesTotal : Number)
{
txtLoaded.text = String (Math.floor (bytesLoaded / bytesTotal * 100)) + "% loaded";
progress_mc._xscale = bytesLoaded / bytesTotal * 100;
};
loadListener.onLoadComplete = function ()
{
trace ("onLoadComplete");
txtLoaded._visible = false;
progress_mc._visible = false;
};
mclTV.addListener (loadListener);
mclTV.loadClip ("main.swf", mcBackground); //mcBackground is an empty movieClip on the stage
txtLoaded._visible = false;
progress_mc._visible = false;

Poor Image Quality When Loading JPEG File Using MovieClipLoader.loadClip()
I have a JPEG file that looks fine in Photoshop. When I load it into a movie clip using MovieClipLoader.loadClip() API it renders in much poorer quality than the original. I tried setting _highquality = 2 on the target movie clip object to no avail. Please help.

Preloading A MovieClipLoader() With A MovieClipLoader() Inside
Is it posible to make a preloader of a SWF that loads an external JPG?

Thanks

Preloading A MovieClipLoader() With A MovieClipLoader() Inside
Is it posible to make a preloader of a SWF that loads an external JPG?

Thanks

LoadClip Help Please
hello,

i'm trying to load swf's into my movie but am experiencing strange stuff (movie not stopping on the frames i tell it to..)
if i use:code: on (release)
{
loadMovie("about.swf", "");
} shouldn't that load the swf into the top left corner of the root time line and replace the existing movie?

thanks because i'm getting pretty confused here!

- monkeybrainz

LoadClip()
Yoh yoh... I use the loadclip to load different jpgs to an mc just like a photogallery.

But when I use the _alpha on the mc,
it only works to set it to 0.

If I set it to 100 when it is loaded, the mc is visible at all time.
( even when it is loading ).

Anyone had similar problem ?

Is LoadClip AS2 Only?
does loadClip only work if your movie is exported using actionScript 2?

[F8] LoadClip
Is it possible to load multiple swf files into one empty movie clip on different depths then be able to switch between those depths. If so, can someone help me with the code?

Thanks,
~SC

LoadClip() Help
I have a loadClip function work fine locally, but when I upload the same exact files in the same folder and run off the server I get a URLNotFound error with the HTTPstatus = 0. Do I need to set some server configuration parameters or something?

BTW, I'm calling a relative path and the SWF is in the same folder as the JPG.

For example: loadClip("name.jpg", MC);

Thanks!

LoadClip
When I use loadClip for some reason...and this is where I need help...all the MCs within the loaded clip play...all the stop actions are ignored...help.

LoadClip
I'm loading jpgs into a gallery with loadClip.

Once loaded I can control the jpgs' _height, _width and _alpha properties but although the _x and _y properties trace as having changed, the jpeg does not move.

Here is my code:


Code:
//LOAD IMAGE///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

public function loadImage( i:Number):Void {

if( i !== undefined) {
currentImage = i;

}

moveThumbnails();

var imageLoader:MovieClipLoader = new MovieClipLoader;
var imageListener:Object = new Object;
imageLoader.addListener(imageListener);

imageListener.onLoadInit = Delegate.create(this, imageLoaded);

imageLoader.loadClip(imageArray[currentImage -1], galleryContainer.imageContainer_mc);
}

//ON IMAGE LOADED/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

private function imageLoaded(thisImage):Void {
thisImage._x = -100;
thisImage._alpha = 50;
thisImage._height = 250;
}
Thanks

Using Loadclip On A Cd
I have created a flash presentation with extensive use of loadclip. Loadclip is pulling swf files from a swf folder. Works perfectly when testing it in the Flash. The problem is when I publish the swf files to html.

I am using swfobject to load the main movie, which in turns calls the external swfs. These external swfs are not loading. What url string do I need to use in loadclip so these external movies will play from a cd.

Here's is my index.html page.


Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>EERD Virtual Tour</title>
<link href="css/global.css" rel="stylesheet" type="text/css" />
<link href="css/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript" src="js/swfobject.js"></script>
</head>

<body>
<div id="container" class="textSm black">
<div id="flashcontent">
</div>
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("swf/mainEERDVT.swf", "EERD", "950", "620", "8", "#000000");
so.write("flashcontent");
// ]]>
</script>
</div>
</body>
</html>
Thanks, Tim

How To Use Loadclip
Hello,
I would like to know how to apply loadclip to the following code so when I click a thumbnail the selected JPEG thumbnail it will load with the transition effect. Thanks,
WonderWendy







Attach Code

import mx.transitions.*;
import mx.transitions.easing;

this.createEmptyMovieClip("image_mc", this.getNextHighestDepth());
var mclListener:Object = new Object();
mclListener.onLoadStart = function(target_mc:MovieClip) {
//do something
};
mclListener.onLoadComplete = function(target_mc:MovieClip) {
//do something
};
mclListener.onLoadInit = function(target_mc:MovieClip) {
TransitionManager.start(target_mc,
{type:Blinds, direction:Transition.IN,
duration:2, easing:None.easeNone,
numStrips:10, dimension:0});
};
var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);
image_mcl.loadClip("http://www.helpexamples.com/flash/images/image1.jpg", image_mc);

Using LoadClip With Xml
I am new to actionscript and I am using a tutorial I found to see what info I could bring in when you click on an icon.

The setup:

I have an xml file with tags defined. I am using a carosel tutorial, and when clicked the icon moves and then the other icons fade away and then dynamic text is displayed that is defined in the xml document. What I want to do is load a swf file. I have been successful loading one swf file, but it loads with all parent icons. I am using the loadClip parameter.

Action Script:

casey is the instance name of my holder object for my swf files, my error lies in the function released () section.









Attach Code

import mx.utils.Delegate;
import mx.transitions.Tween;
import mx.transitions.easing.*;

var numOfItems:Number;
var radiusX:Number = 300;
var radiusY:Number = 75;
var centerX:Number = Stage.width / 2;
var centerY:Number = Stage.height / 2;
var speed:Number = 0.05;
var perspective:Number = 130;
var home:MovieClip = this;
theText._alpha = 0;
casey._alpha = 0;

var tooltip:MovieClip = this.attachMovie("tooltip","tooltip",10000);
tooltip._alpha = 0;

var xml:XML = new XML();
xml.ignoreWhite = true;

xml.onLoad = function()
{
var nodes = this.firstChild.childNodes;
numOfItems = nodes.length;
for(var i=0;i<numOfItems;i++)
{
var t = home.attachMovie("item","item"+i,i+1);
t.angle = i * ((Math.PI*2)/numOfItems);
t.onEnterFrame = mover;
t.toolText = nodes[i].attributes.tooltip;
t.content = nodes[i].attributes.content;
t.casey = nodes[i].attributes.casey;
t.icon.inner.loadMovie(nodes[i].attributes.image);
t.r.inner.loadMovie(nodes[i].attributes.image);
t.icon.onRollOver = over;
t.icon.onRollOut = out;
t.icon.onRelease = released;
}
}

function over()
{
//BONUS Section
var sou:Sound = new Sound();
sou.attachSound("sover");
sou.start();

home.tooltip.tipText.text = this._parent.toolText;
home.tooltip._x = this._parent._x;
home.tooltip._y = this._parent._y - this._parent._height/2;
home.tooltip.onEnterFrame = Delegate.create(this,moveTip);
home.tooltip._alpha = 100;
}

function out()
{
delete home.tooltip.onEnterFrame;
home.tooltip._alpha = 0;
}

function released()
{
//added by casey for loading swfs
var mcl:MovieClipLoader = new MovieClipLoader()
mcl.loadClip("test.swf",casey)
//end of caseys code

//BONUS Section
var sou:Sound = new Sound();
sou.attachSound("sdown");
sou.start();

home.tooltip._alpha = 0;
for(var i=0;i<numOfItems;i++)
{
var t:MovieClip = home["item"+i];
t.xPos = t._x;
t.yPos = t._y;
t.theScale = t._xscale;
delete t.icon.onRollOver;
delete t.icon.onRollOut;
delete t.icon.onRelease;
delete t.onEnterFrame;
if(t != this._parent)
{
var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,t._xscale,0,1,true);
var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,t._yscale,0,1,true);
var tw3:Tween = new Tween(t,"_alpha",Strong.easeOut,100,0,1,true);
}
else
{
var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,t._xscale,100,1,true);
var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,t._yscale,100,1,true);
var tw3:Tween = new Tween(t,"_x",Strong.easeOut,t._x,200,1,true);
var tw4:Tween = new Tween(t,"_y",Strong.easeOut,t._y,320,1,true);
var tw5:Tween = new Tween(theText,"_alpha",Strong.easeOut,0,100,1,true);
var tw6:Tween = new Tween(casey,"_alpha",Strong.easeOut,0,100,1,true);
theText.text = t.content;
var s:Object = this;
tw.onMotionStopped = function()
{
s.onRelease = unReleased;
}
}
}
}

function unReleased()
{

//BONUS Section
var sou:Sound = new Sound();
sou.attachSound("sdown");
sou.start();

delete this.onRelease;
var tw:Tween = new Tween(theText,"_alpha",Strong.easeOut,100,0,0.5,true);
var tw:Tween = new Tween(casey,"_alpha",Strong.easeOut,100,0,0.5,true);
for(var i=0;i<numOfItems;i++)
{
var t:MovieClip = home["item"+i];
if(t != this._parent)
{
var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,0,t.theScale,1,true);
var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,0,t.theScale,1,true);
var tw3:Tween = new Tween(t,"_alpha",Strong.easeOut,0,100,1,true);
}
else
{
var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,100,t.theScale,1,true);
var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,100,t.theScale,1,true);
var tw3:Tween = new Tween(t,"_x",Strong.easeOut,t._x,t.xPos,1,true);
var tw4:Tween = new Tween(t,"_y",Strong.easeOut,t._y,t.yPos,1,true);
tw.onMotionStopped = function()
{
for(var i=0;i<numOfItems;i++)
{
var t:MovieClip = home["item"+i];
t.icon.onRollOver = Delegate.create(t.icon,over);
t.icon.onRollOut = Delegate.create(t.icon,out);
t.icon.onRelease = Delegate.create(t.icon,released);
t.onEnterFrame = mover;
}
}
}
}
}


function moveTip()
{
home.tooltip._x = this._parent._x;
home.tooltip._y = this._parent._y - this._parent._height/2;
}

xml.load("icons.xml");

function mover()
{
this._x = Math.cos(this.angle) * radiusX + centerX;
this._y = Math.sin(this.angle) * radiusY + centerY;
var s = (this._y - perspective) /(centerY+radiusY-perspective);
this._xscale = this._yscale = s*100;
this.angle += this._parent.speed;
this.swapDepths(Math.round(this._xscale) + 100);
}

this.onMouseMove = function()
{
speed = (this._xmouse-centerX)/2500;
}[h]Text[/h][h]var tw:Tween = new Tween(casey,"_alpha",Strong.easeOut,100,0,0.5,true);[/h]

























Edited: 03/18/2007 at 03:32:29 PM by noobkc

LoadClip On PC Vs. MAC
Hi, I noticed that if I perform a LoadClip of an image, it works on a PC, but not on a MAC. Does anyone know why?

LoadClip For .png?
Hey Kirupians,


I've been using :

PHP Code:



my_mcl.loadClip(url:String, target:Object ) : Boolean 




for my .swf and .jpg loading, but it doesn't allow for .pngs to be accessed this way. I can't seem to find the right code to use for .png's.. anyone know?

Thanks

~ Lacuna

LoadClip For .png?
Hey Kirupians,


I've been using :

PHP Code:



my_mcl.loadClip(url:String, target:Object ) : Boolean 




for my .swf and .jpg loading, but it doesn't allow for .pngs to be accessed this way. I can't seem to find the right code to use for .png's.. anyone know?

Thanks

~ Lacuna

LoadClip()
i'm use this code:

ActionScript Code:
my_mc=new MovieClipLoader();
listener=new Object();
 
listener.onLoadComplete=function(target){
 my_mc2.gotoAndPlay(2);
}
my_mc.addListener(listener);
my_mc.loadClip("photo.jpg",this.my_scene);

but my_mc2 start before photo.jpg loaded
i don't understand!!!

and other problem:

i read from photo.xml the target from photo.
if i load with my_scene.loadMovie(numberPhoto[number]) it's work(i don't control de loading)
if i load whith photo.loadClip(numberPhoto[number],this.my_scene) don't work(loadClip it should have the loader function)

Problems With Loadclip
im having problems telling movieclip to start after they are loaded...
im doing this

createEmptyMovieClip("nav", 0);
mcl.loadClip("navi.swf", nav);

i have this code in the listener section....

mclListener.onLoadComplete = function(mclname)
{
trace("finished");
nav.gotoAndStop(2);
}

a trace and the command to tell the loaded movie to goto its second frame. the trace is coming back in my output window but the movie clip i loaded is not going to the second frame like it is supposed to...

the navi.swf is a movie with a blank 1st frame with a stop action and a navigator bar clip on the second frame.

ive tried everthing....please help....it tried _parent.gotoAndStop(2);,_level0.nav.gotoAndStop(2) ;, _root.gotoAndStop(2);, i tried placing it outside the listner function. for some reason i can't tell the newly loaded clip to play no matter what?

Help Please With Preload And Loadclip
Hi guys, i've got two problems the first one is this:

1) I've got an swf called preload.swf, in the first frame i've got this code:

percentual = Math.round((_level1.getBytesLoaded()/_level1.getBytesTotal())*100) add "%";

_root.loader.gotoAndPlay(Math.round((_root.getByte sLoaded()/_root.getBytesTotal())*100));

and then in the second an i condition...

well, everthing works ok... but animated preloader suffer a problem... when it loads the loader seem to play example 55,56,55,56 frame and this gives a weird effect on the animation... i think it's a problem of getting datas from an external swf from level1, because when i try getting information from _root the evolution of loader is fine (55,56,57,58 etc)... there's way to find a solution to this?

Because if I use a preloader inside level1 i get preload starts from 50% because of a lot of actionscript.


the second question is this:
2) is it possible to load inside a movieclip together 1 external jpg and a symbol from library?


Thanks all
Evol

LoadClip And Position JPG
I am trying to load thumbnail images dynamically, then position them vertally. Then turn them in to buttons. Below is my attempt. The images load, but do not space. Any ideas?


Code:
var vSpace:Number = 3;
var totalWheels:Number = 20;
var alphaOver:Number = 20;
//MoiveClip Loader
function loadExtMov(movieName, targetMovie) {
var mclListen:Object = new Object();
mclListen.onLoadStart = function(target_mc:MovieClip) {
//action
};
mclListen.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
//action
};
mclListen.onLoadError = function(target_mc:MovieClip) {
trace("ERROR: The external file "+movieName+" did NOT load");
};
mclListen.onLoadComplete = function(target_mc:MovieClip) {
//action
};
mclListen.onLoadInit = function(target_mc:MovieClip) {
trace("The external file "+movieName+" was loaded in to"+target);
spaceImg();
};
var thumb_mcl:MovieClipLoader = new MovieClipLoader();
thumb_mcl.addListener(mclListen);
thumb_mcl.loadClip(movieName, targetMovie);
}
//Load Image loop
function imageSelect() {
for (i=0; i<=totalWheels; i++) {
thumbHolder = createEmptyMovieClip("img"+i+"_mc", i);
loadExtMov("images/w"+i+".jpg", "img"+i+"_mc");
}
}
imageSelect();

//position images
function spaceImg() {
for (i=0; i<=totalWheels; i++) {
_root["img"+i+"_mc"]._y += _root["img"+i+"_mc"]._height+vSpace;
// buttons
}
_root["img"+i+"_mc"].onRelease = function() {
loadMovie("images/portraits/img0.jpg", _root.img_mc);
};
_root["img"+i+"_mc"].onRollOver = function() {
_root["img"+i+"_mc"]._alpha = alphaOver;
};
_root["img"+i+"_mc"].onRollOut = function() {
_root["img"+i+"_mc"]._alpha = 100;
};
}

Random Loadclip
Hi
I was wondering if it was possible to load a random .swf in an empty movieclip: let's presume I have a upper banner with photos; it would be cool if the images, loades as external .swf, could change every time i refresh the page (and the main movie as well). Is it possible?

Loadclip In As2.0 Class
Hi,

I've got a problem using loadclip in a as2.0 imagecontainer class.
It works fine when i place the image container on Stage, but when I attach the clip dynamically with attachmovie, nothing happens. this is what the class looks like. Does anybody have any ideas about this?

when i do a trace in the loadImage function everything seems to be normal, nothing is null or undefined...

Code:
class imagecontainer extends movieclip
{
function imagecontainer()
{
target = createEmptyMovieClip("target")
}

function loadImage( file )
{
var lc = new MovieClipLoader()
lc.addListener(this)

lc.loadclip( file, target )
}

}

in the .fla file i write something like this:

var im = attachMovie("imagecontainer", "image", 10)
im.loadImage( 'file.jpg' )

LoadClip Issue Help
Hi,
Im loading swf files in my movie with the loadClip Method.

When im testing it on my local machine it work great, but when im uploading it to the hosting server, it loads the first swf file but when i click to load another movie instead of the first , it fails and says "url not found".

But...if i have those swf filles cached it works.

p.s

HELP !

[F8] Using Loadclip In FireFox
I've juste complete a web site that I've publish on a Linux server. But all my LoadClip functions are not working when I'm using Firefox. I've tested my site on a Windows server and everything worked fine. Is there something I can do or an other function I can use to be able to load an external .SWF using FireFox and a linux server?

Here is the function Im using :

var myLoader:MovieClipLoader = new MovieClipLoader();
myLoader.loadClip("content\MyMovie.swf","mcMyMovi e");

Thanks.

LoadClip(), For Loop, _x Pos...
Hey all... Looking for a little direction here. Just now getting into XML and dynamic menu creation and all... Working on a little slideshow action, but having a hard time getting my clips positioned.

I can load everything. it's all there. What I can't do, is position each clip based on the loop iteration, that is... current clip's X is = i * (clip width + spacer) (code below)

Basically, everything traces as I need it to, except for the iteration! it onlly traces as the final, in this case, 4. The result being all the thumbs stacked on top of one another. I've tried dozens and dozens of variations of my script... now I'm at a loss. can someone tell me where the problem is?

Thanks,
-BK



code:

spacer = 1;
posX = 100;
posY = 100;


////////// load XML
var gal_xml = new XML();
gal_xml.ignoreWhite = true;
gal_xml.onLoad = function(success){
if (success){

//////////// create sets and thumbs arrays
var sets = this.firstChild.childNodes;
var thumbs:Array = this.firstChild.firstChild.childNodes;

var setHolder:MovieClip = _root.createEmptyMovieClip("setMenu",_root.getNext HighestDepth());
setHolder._x = posX;
setHolder._y = posY - 21;

var thumbHolder:MovieClip = _root.createEmptyMovieClip("container", _root.getNextHighestDepth());
thumbHolder._x = posX;
thumbHolder._y = posY;


///////////// create title menu
for(s=0; s < sets.length; s++){
var item = setMenu.attachMovie("menuItem", "set_"+ s, setMenu.getNextHighestDepth());
var setX:Number = s * (item._width + spacer);
item.menuText.text = sets[s].attributes.menuTitle;
item._x = setX;
}

////////// Create Thumbnails
for(t=0; t<thumbs.length; t++){
tHolder = container.createEmptyMovieClip("thumb_"+ t, container.getNextHighestDepth());
thumb = thumbs[t].attributes.thumb;
mcl.loadClip(thumbs[t].attributes.thumb, tHolder);
trace(thumb);
}
}
}


////////// thumbnail listener and loader
var mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();

mclListener.onLoadStart = function(_mc:MovieClip) {
}

mclListener.onLoadProgress = function(_mc:MovieClip) {
}

mclListener.onLoadInit = function(_mc:MovieClip) {
trace(_mc);
}


///// go
mcl.addListener(mclListener);
gal_xml.load("imagePath.xml");

The LoadClip Method
I recently ran into some problems when duplicating a movie clip, and then I found this...


Quote:




If you used MovieClip.loadMovie() or the MovieClipLoader class to load a movie clip, the contents of the SWF file are not duplicated. This means that you cannot save bandwidth by loading a JPEG, GIF, PNG, or SWF file and then duplicating the movie clip.




I am loading pictures from a database in my current project, and the same picture will be reused several times. Do I have to reload the picture everytime I want to use it? How can I avoid this. Is there a way to save a picture to some variable, movieclip, or common space (such as a library), and then reuse it whenever it is needed?

No Sound With LoadClip
I'm using loadClip to create a preloader for my game. Everything works perfectly except the sound which for some reason doesn't play at all when the game is loaded through the preloader. If I load it directly it plays fine though.

Any ideas?

LoadClip GetProgress
Hi there! I am new here. I am having some problem with my code. I am using loadclip in a container and I am using getProgress with interval. The problem is that when I simulate download test my flash it works perfectly and show me the status of downloading swf in my container. But when I upload that site the loader does not work. here is my code.

import mx.transitions.Tween;
import mx.transitions.easing.*;

var scene:String = new String();
var project:String = new String();
var portfolio:String = new String();
var mcLoader:MovieClipLoader = new MovieClipLoader();
var listener:Object = new Object();
var chk:Boolean = new Boolean();
chk = true;

mcLoader.addListener(listener);
mcLoader.loadClip("media/mainBg.swf",image);

var interval:Object = new Object();
interval.id = setInterval(checkProgress, 100, mcLoader, image, interval);

function checkProgress(mcLoader:MovieClipLoader, image:MovieClip, interval:Object){
var progress:Object = mcLoader.getProgress(image);
percentage = Math.floor((progress.bytesLoaded / progress.bytesTotal) * 100);
val = percentage + "%";
setProperty("loader", _xscale, percentage);
if(progress.bytesLoaded == progress.bytesTotal) {
clearInterval(interval.id);
if(chk){
var motionTween:Tween = new Tween(image, "_alpha", mx.transitions.easing.Regular.easeOut, 0, 100, 1, true);
motionTween.onMotionFinished = function(){
_root.image.play();
}
chk = false;
}
}
}

function loadPortfolioList(portfolio:String){
_root.attachMovie(portfolio + "_mc", portfolio + "MC", _root.getNextHighestDepth());
eval(portfolio + "MC")._x = 333;
eval(portfolio + "MC")._y = 482;
var motionTween:Tween = new Tween(eval(portfolio + "MC"), "_alpha", mx.transitions.easing.Regular.easeOut, 0, 100, 1, true);
}

function jump2Scene(scene){
if(scene == "residential"){
gotoAndPlay("residential", 1);
}else if(scene == "mainPage"){
gotoAndPlay("mainPage", 1);
}
}

function loadAnotherMovie(project:String, image:MovieClip){
mcLoader.loadClip("media/" + project + "/" + project + ".swf", image);
interval.id = setInterval(checkProgress, 100, mcLoader, image, interval);
}

stop();

[MX04] LoadClip()
I use loadClip() to load a lot of swf files into my movie. I uploaded the site to the server. Sometimes I get an error while the movie tries to load one swf file few times in different movieclips one by one. onLoadError() returns "URLNotFound" (but I know for sure that the file existents). Sometimes this process succeeds with no error (it loads one swf file few times in different movieclips).

I tried to reload the swf file inside the onLoadError(). But it didn't solve the problem.

Any ideas?

LoadClip() Problem
Hi

I have a training course im putting together with actionscript 2. Iv created a pre-loader with this code:


Code:
var listener = new Object();

var mcl = new MovieClipLoader();

mcl.addListener(listener);

listener.onLoadProgress = function(target_mc:MovieClip,bytesLoaded:Number,bytesTotal:Number){
var percentage:Number = bytesLoaded/bytesTotal*100;
//and then you do what you want with the percentage..


}
listener.onLoadInit = function(){
//when its done loading do what you want.
_root.ClipHolder2.slide1.gotoAndPlay(2);

}

createEmptyMovieClip("ClipHolder2",getNextHighestDepth());
mcl.loadClip("course1.swf",ClipHolder2);


it loads the clip in fine, but the actionscript in the "course1.swf" doesnt seem to work at all when its loaded up

I mean slide1.gotoAndPlay(2) here works, but its only showing the text and graphics on that slide and not running the actionscript to play the mp3 file

Ideas?

LoadClip Question
This is a stupid question I am sure but after dynamically loading images into a MC. The MC is no longer targetable. (Is that a word? Oh well.) If I don't load the jpeg then all my onRollOvers and stuff work fine.

What do I need to do?

Why Isn't LoadClip Working?
Hey everyone!

i'm quite an advanced actionscripter and i can't understand why loadClip forSWFs isn't working!

I'm creating the moviecliploader, and using it to load an external SWF. i know that it loads because i used the onLoadInit to check if it loads, but i just don't see the movie! i also checked by loading a jpg and that works as well.

is there something that i'm not aware of?

thanks

hers's my simple code:

var myMCL:MovieClipLoader = new MovieClipLoader ();
myMCL.loadClip("gov.swf","container");

LoadClip For A Beginner
Hi there,

I am a reflasher really. Haven't used flash since version 4 so I am way behind.
Have php experience too.
Anyway I am having a problem loading in swf files using loadClip.

On the main timeline frame 1 i have:
var myMCL:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();

myMCL.addListener(myListener);

I then have a script:
on (release) {
myMCL.loadClip("about.swf", container1);
}

which is three levels down. It is a movie clip inside a movie clip.
Heirarchy is as follows: scene1/navbar/nav

I cannot seem to get the "about.swf" file to load onto the top level in a movieclip called container1 instance name container1.

Hope this all makes sense.

Cheers

Copyright © 2005-08 www.BigResource.com, All rights reserved