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




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;
};
}



FlashKit > Flash Help > Flash ActionScript
Posted on: 04-13-2005, 09:14 PM


View Complete Forum Thread with Replies

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

Setting LoadClip To A Position
hey guys,

i know this is probably quite simple but am no sure how to do it.

basically i got the code to creat a movieclip loader and it works fine loads the external .swf sucessfully. but what am no sure about is setting it so the loaded clip is set to a specific position say 100x and 150y for example.

can some one please help.

hears the code i current have (this is one frame1)


Code:

var myMCL:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();

myMCL.addListener(myListener);

myListener.onLoadProgress = function(target_mc:MovieClip, loadedBytes:Number, totalBytes:Number) {
_level50._visible = true;
var preloadPercent:Number = Math.round((loadedBytes / totalBytes) * 100);
_level50.preloader.gotoAndStop(preloadPercent);
}

myListener.onLoadComplete = function(target_mc:MovieClip) {
_level50._visible = false;
and this code is on frame 5;


Code:
myMCL.loadClip("testing1.swf", 5);
as i mentioned this all works. just need to know what needs to be added. thanks in advance

Reset Movie Clip X-position & Y-position Back To Original
Is there a command to reset x-position, y-position and rotation all at once...like reset command?...or would I have to find the original x-positions and y-positions to all elements and hardcode that back....EEEK!!

Many Thanks
Andrea

SoundChannel.position - Trouble Triggering Event Based On .position
I would like to trigger an addChild event when my mp3 reaches a certain point.

My trace statements will only fire if I use <= but not ==

The goal is to add text to the stage when the MP3 has reached one second, what am I missing?

Ultimately there will be several trigger marks I need to hit along the MP3.


ActionScript Code:
var buffer:SoundLoaderContext = new SoundLoaderContext(10000);var welcome:Sound = new Sound(new URLRequest("Intro.mp3"), buffer);var welcomesc:SoundChannel = welcome.play();addEventListener(Event.ENTER_FRAME, playMessage);function playMessage(event:Event):void{trace(Math.floor(welcomesc.position));if (welcomesc.position == 1000)    {        trace("NOW!!!!!!!");    }    else    {        trace("WAIT-------------");    }welcomesc.addEventListener(Event.SOUND_COMPLETE, soundComplete);}

How To Position Mc_example Depending On Position Of Empty Movieclip?
I have a series of movieclips (graphics) which I want to position in a row.
I know that I can define the position of each movieclip individually by _x and _y. But can I place an empty MC on the stage and define the position of every single MC with _x and _y IN RESPECT TO THE POSITION OF THE EMPTY MC - so that ALL movieclips will change their position when I move the empty mc?

Thanks for helping
Aribert

[F8] Control Position Of Playhead In Movieclip By Position Of A Button
I am fairly new to actionscripting and just need a little help.

I have a bar which has a slideable block on it. When this block is dragged, to the left/right i want it to control the playhead inside another movieclip.

For example, when the block is to the far left, the playhead (of my movieclip) will be at the first frame. When the block is dragged to the right it will play the movieclip at the speed that the block is being moved and when it is at the far right it will be on the last frame of the movieclip. And when the block is dragged to the left it will play the movie backwards at the same speed etc...

It is just like the scrubber bars that are in media players, but instead of playing an actual video, i want to play the movieclip which is of an animation.

How would I do this?

Thanks

Flash Y Position Converted To Browser Scroll Position
I have a Flash movie that makes an fscommand call to the HTML page, and via Javascript, it moves the browser window scroll position down. I need to be able to scroll down to a position that coincides with a Y position on my Flash page, but I can't seem to figure out how to convert coordinates from a Flash Y position to a browser-window vertical scroll position. I hope this makes sense. Does anyone know how to do this? (I have all the code working to do this, except for this coordinate issue. That's the only part I need.)

Example:

Code:
myMC.onRelease = function() {
//Command to Javascript function in html doc
//Scroll down in browser to Y pos specified
//This scrolls down to 1000 position within browser window but
//but does NOT equate to a Y position of 1000 in .swf movie
//even if .swf movie is at 0,0 left & top margins within browser
fscommand("scrollToAnchor",1000);
};
Ultimately, what I am trying to do is simulate anchor points from HTML (not anchor points in Flash to go 'Back'), whereby you have a link at the top of the page, and you click it and it takes you somewhere else lower on the same page. Then you have a link there that says "Back to top", and it takes you back to the top of the page, etc.

Any ideas?

X Position? Y Position? Differs In MovieClips From _root?
Hey!

I'm confused:

I want to move a movieClip that is embedded in another movieClip:

firstMovieClip >> floatingMovieClip

Now, X = 0 IS NOT the upper left corner when I try to direct floatingMovieClip.

When I investigate the movieClip sets it's X = 0 in the middle. But on _root lever, X = 0 is the upper left corner.

Is it supposed to be this silly way?

THanks!
Regards

Help With Tweening From Current Position To Clicked Position
Hi
I have a motion tweening question-
I have a large rotary dial with an arrow on it, around that are 5 buttons. I want to set it up so that when the user clicks any button, the rotary dial will rotate until the arrow is pointing to that particular button. I can't figure out how to make it so that the dial tweens from one position to the other, which is of course dicated by where the user clicks. I also want that dial to stay pointed to that specific button until another one is clicked.

How can I do this?

Thanks!!!

-Steve

Mouse X Position To Control Movie Position?
Hi, my understanding of actionscript is very basic and I'd like some help with writing a very simple script. Basically the x position of the mouse should control the play position of a movie. Do I need something like an event handler (I'm not sure exactly what these do, but I've seen similar scripts that seem to use them).

Reported X Position Doesn't = Actual X Position?
I can't figure this out. I'm loading a serious of pages of images in the same flash document, but all pages after the first one have a lower y position of about the height of one of the images. When I trace their y position they all say 30, when it's clearly more like 150. What's going on here?

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)

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.

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

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

LoadClip Issues
I have an empty mc in my main swf called mcThemePreview. I want to load an mc into it so I do this:


ActionScript Code:
var owner = this;
var mclThemePreview = new MovieClipLoader();
mclThemePreview.onLoadInit = function()
{
    trace("xPreviewScale = " + owner.mcThemePreview.txtXPreview.text);
    trace("yPreviewScale = " + owner.mcThemePreview.txtYPreview.text);
};
mclThemePreview.loadClip(thisFamilySwf, mcThemePreview);

The actionscript is all seperate from my fla files. When I change the value of my textfields, which is set in my fla, and then republish everything, the values aren't changed with the trace statement. Is there something that I am doing wrong or something that I am not doing that I need to be doing? I can't figure it out.

Jason

Why Not? (MCLoader.loadClip)
trace(chargeur.loadClip(urrentMap[drawmapx][drawmapy].image_str,loadimageshere_mc))

aways traces false!!!???

The problem is that since it always traces false and it doesn't load anything ecoute.onLoadInit() is never called.

loadimageshere_mc's declared earlier:
var loadimageshere_mc:MovieClip;

This is my code in case it makes any difference:

ActionScript Code:
lengthUsed++;
        //createEmptyMovieClip("loadimageshere_mc",0-lengthUsed)
        //loadMovie(currentMap[drawmapx][drawmapy].image_str,loadimageshere_mc);
        var chargeur:MovieClipLoader= new MovieClipLoader();
        var ecoute:Object=new Object();
        ecoute.onLoadInit=function(){
            trace("ecoute.onLoadInit=function()");
            eval("BitmapData_"+String(NextBuff)+".draw(loadimageshere_mc)");
            imagesLoadedSoFar[1][lengthUsed]=eval("BitmapData_"+String(NextBuff));
            createEmptyMovieClip("mapHolder_mc.t_"+String(drawmapx)+"_"+String(drawmapy), drawmapx+drawmapy*100);
            eval("mapHolder_mc.t_"+String(drawmapx)+"_"+String(drawmapy)+".attachBitmap(imagesLoadedSoFar[1][lengthUsed], 2)");
            //duplicateMovieClip(imagesLoadedSoFar[1][lengthUsed], "mapHolder_mc.t_"+String(drawmapx)+"_"+String(drawmapy), drawmapx+drawmapy*100);
            set("mapHolder_mc.t_"+String(drawmapx)+"_"+String(drawmapy)+"._x",drawmapy*50);
            set("mapHolder_mc.t_"+String(drawmapx)+"_"+String(drawmapy)+"._y",drawmapx*50);
            yep=0;
            trace(target_mc);
            trace(eval("mapHolder_mc.t_"+String(drawmapx)+"_"+String(drawmapy)));
        }
        chargeur.addListener(ecoute);
        trace(chargeur.loadClip(urrentMap[drawmapx][drawmapy].image_str,loadimageshere_mc));
        imagesLoadedSoFar[0][lengthUsed]=currentMap[drawmapx][drawmapy].image_str;
        nextBuff++;
Also the whole thing is in a function that's called 2500 times if it makes any difference...

LoadClip Problem
I have a problem and wondering if anyone could help.
Part of code:

------------------------

for (i=0; i<nodes.length; i++) {

_root.createEmptyMovieClip(movieName[i],_root.getNextHighestDepth());
mcLoader.addListener(myListener);
mcLoader.loadClip(photo[i], _root[movieName[i]]);

}

------------------------

Everything works just fine, but all my pictures start loading all at the same time (makes sense, because the loop works faster than loadClip ) . I want them to be loaded one by one. The site is code only and I don't want to change that. I've tryied to delay the loading process with setInterval , but no good results. Any ideea?

LoadClip Error...
Hi all,

When I run this on my timeline it works fine


Code:
mcl.loadClip(Math.floor(Math.random() * 6) + ".jpg", this);
I changed the code so that it will load a specific image but when I run this it gives me an error! Any ideas?

Code:
mcl.loadClip(Math.floor("1.jpg", this);
This is the fucntion at the beginning of my movie, but don't need to change that just need to edit the above line...


Code:
var mcl:MovieClipLoader = new MovieClipLoader();

function onLoadInit(targ:MovieClip):Void
{
// Fade to 100 in 3 seconds using the easeoutquad tween
targ.alphaTo(100, 3, "easeoutquad");
}

// Start the MCL working
mcl.addListener(this);

SetMask() And LoadClip()
Hi all.

I have created a movie clip which has three layers.

layer 1. Is the mask the code is:

PHP Code:



onClipEvent(load){
    _root.mcPicture.setMask(this);





larer 2. is the picture which is a normal picture and the instance name is mcPicture.

layer 3. is the blured picture.

Now this all works fine no problems. The settings are flash player 8 and action script2 and saved as picture.swf

now when i try to load the swf into another swf using the loadClip() function now the movie loads fine but the mask dosent work?!

does anyone know why this could be?

the settings of the movie i am loading picture.swf into are the same as picture.swf .

Help would be great!

thanks in advance

LoadClip Bloating?
Code:
//Turning Movie Poster Back On
poster_mc._visible = true;

//Loading and Formatting Movie Poster
var myMCL:MovieClipLoader = new MovieClipLoader();
var ml:Object = new Object();
ml.onLoadInit = function(target_mc:MovieClip) {
target_mc._height = 152;
target_mc._width = 102;
}
myMCL.addListener(ml);
_root.createEmptyMovieClip("poster_mc",1);
myMCL.loadClip(mimgurl1, poster_mc);
stop();
This is the image display code I use for a movie rating system. Every time you switch to view the next movie, it sets poster_mc.visible = false. Every time it finishes the animation, it executes the code above.

So my question is this, every time it sets poster_mc's visibility to true and loads a different image, is the old image under the new one or is it replaced?

If it's still just sitting under the new image, how can I get rid of it to avoid bloating?

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.

Loadclip Not Working
i am trying to preload an image, and when its done, it is displayed with an MC. I have done this hundreds of times, but for some reason, it is only showing a gray box.

im using this code ... from within _root.imageloader

ActionScript Code:
loadBar._visible = false;
my_mc = new MovieClipLoader();
preload = new Object();
my_mc.addListener(preload);
preload.onLoadStart = function(targetMC) {


image1mc._visible = false;
loadBar._visible = true;


};
preload.onLoadProgress = function(targetMC, lBytes, tBytes) {

loadBar._width = (lBytes/tBytes)*100;

};
preload.onLoadComplete = function(targetMC) {

image1mc._visible = true;
loadBar._visible = false;

};

preload.onLoadInit = function (targetMC)
{
        targetMC._width = 450;
        targetMC._height = 338;
}
//default image
my_mc.loadClip("image1.jpg","imagemc");

i have specified the path as "image1.jpg", but for some darned reason nothing happens.

LoadClip And PreLoaders
I am trying to finish a website that I created in Flash. It has one main swf which then loads each page's content into itself. Originally I did not have any preloaders set up and I used loadMovie for each of the pages. When I added a preloader I changed everything to loadClip. However now the content of each page is on a level higher than the main swf and the drop down navigation bar, which is in the main swf, is hidden behind the loaded content.

To try to fix that problem I made the navigation bar a seperate swf and am now using loadClip to load it on a higher level than the content so that it appears in front. But now I cannot get the actionscript on the buttons in the navigation bar to work.

There are several ways to solve this problem that might work but I don't know enough about actionscript to know how to do them.


Code:
CODE MAIN PAGE:
var topmenu = this.createEmptyMovieClip("topmenu", "50");
topmenu._x = 52;
topmenu._y = 136;
loadMovie("menu.swf", "topmenu");

bar._visible = false;
border._visible = false;
var empty = this.createEmptyMovieClip("container", "1");
empty._x = 96;
empty._y = 207;

my_mc = new MovieClipLoader();
preload = new Object();
my_mc.addListener(preload);

preload.onLoadStart = function(targetMC) {
trace("started loading "+targetMC);
container._visible = false;
border._visible = true;
pText._visible = true;
};

preload.onLoadProgress = function(targetMC, lBytes, tBytes) {
pText.text = Math.round((lBytes/tBytes)*100)+"%";
};

preload.onLoadComplete = function(targetMC) {
container._visible = true;
border._visible = false;
pText._visible = false;
trace(targetMC+" finished");
};

my_mc.loadClip("home.swf", "container");


stop();

this.topnav_mc.home_btn.onRelease = function() {
my_mc.loadClip("home.swf", "container");
topnav_mc.gotoAndStop("closed");
};
this.topnav_mc.services_btn.onRelease = function() {
my_mc.loadClip("steelservices.swf", "container");
topnav_mc.gotoAndStop("closed");
};

this.topnav_mc.ftp_btn.onRelease = function() {
getURL("ftp://orangecountyironworks.org/", "blank");
topnav_mc.gotoAndStop("closed");
};
this.topnav_mc.contact_btn.onRelease = function() {
my_mc.loadClip("contact.swf", "container");
topnav_mc.gotoAndStop("closed");
};
this.topnav_mc.aboutoci_btn.onRelease = function(){
my_mc.loadClip("about.swf", "container");
};
this.home_btn.onRelease = function() {
my_mc.loadClip("home.swf", "container");
};
this.about_btn.onRelease = function() {
my_mc.loadClip("about.swf", "container");
};
this.services_btn.onRelease = function() {
my_mc.loadClip("steelservices.swf", "container");
};
this.projects_btn.onRelease = function() {
my_mc.loadClip("residential.swf", "container");
};
this.testimonials_btn.onRelease = function() {
my_mc.loadClip("testimonials.swf", "container");
};
this.news_btn.onRelease = function() {
my_mc.loadClip("news.swf", "container");
};
this.ftp_btn.onRelease = function() {
getURL("ftp://orangecountyironworks.org/", "blank");
};
this.contact_btn.onRelease = function() {
my_mc.loadClip("contact.swf", "container");
};

CODE ON MENU SWF
stop();
this.projects_btn.onRelease = function() {
gotoAndPlay("projects");
};
this.about_btn.onPress = function() {
gotoAndPlay("about");
};
this.aboutoci_mc.onPress = function() {
_root.loadClip("about.swf", "content");
gotoAndPlay("closed");
};

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