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




Combining LoadMovie With AttachMovie



I'm sure there's a simple solution to this, but for some reason it isn't coming to me. What I want to do is be able to dynamically create movieclips on the stage that are linked to a particular class...but here's the catch: I need to load external SWF files into the dynamically created movieclips and still maintain their linkage to my custom class. I'm plenty familiar with using loadMovie to load external SWFs and I also know how to use attachMovie to load library instances onto the stage so that they inherit the methods of the custom class that I have them linked to. But what I haven't figured out is how to combine the two so that I can load an external swf into a movieclip and have it linked to a custom class.

Here's some code that I tried to do, but it didn't seem to work. I tried using attachMovie to load in the library instance that has the class linked to it and then use loadMovie to load the external SWF, but it doesn't seem to load the external swf correctly:

ActionScript Code:
var WidgetName = "Stocks";var WidgetFile = "Widget_Stocks.swf";var LinkageName = WidgetName + "Widget";var ClipName = "mv_Widget_" + WidgetName;var depth = 1;trace("Creating " + WidgetName + " widget using " + LinkageName);mv_Widgets.attachMovie(LinkageName, ClipName, depth);var Widget_mc = mv_Widgets[ClipName];            Widget_mc._x = 0;Widget_mc._y = 0;            trace("Loading " + WidgetFile + " into " + Widget_mc);Widget_mc.loadMovie(WidgetFile);            trace("Type of " + Widget_mc + " is " + Widget_mc._type);

This outputs:

Code:
Creating Stocks widget using StocksWidget
Loading Widget_Stocks.swf into _level0.mv_Widgets.mv_Widget_Stocks
Type of _level0.mv_Widgets.mv_Widget_Stocks is Stocks
So this shows that it links to the class correctly (_type is a parameter of the custom class), but it never loads the external SWF onto the stage, so it seems that the loadMovie command isn't working.

Any ideas?



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 07-05-2007, 05:14 PM


View Complete Forum Thread with Replies

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

Combining AttachMovie And SetInterval
can someone assist me with some code. Just need to get myself some direction. I would like to create a series of movie clips in my file and have them load according to an interval that i set, basically creating a banner ad. Can someone assist me wiht the code? Thanks.

LoadMovie-Combining Two Files
I am working in MX 2004. I have two separate swf files that I need to merge together and export as a projector file to burn to CD. I can get the first movie in place or I can get the second movie in place over the first, but I'm not sure how to script it so that the second swf file will play right after the first swf file.
I'm at a crunch time on this project any help would be gratly appreciated.
Also, i'm not really a programmer, so my Actionscript skills are very weak.

HELP - LoadMovie Then AttachMovie - No Go?
I have a .swf containing mcHolder which is an 'empty' mc.

I loadMovie('movie2.swf', 'mcHolder') - so far so good.

Next I attempt to:


Code:
for(i=0;i<5;i++) {
mcHolder.attachMovie("movie3", "movie3" + i, i);
}
Movie3 never shows up! On the other hand, if I just:


Code:
for(i=0;i<5;i++) {
attachMovie("movie3", "movie3" + i, i);
}
it works fine, but I really want movie3 to be attached to movie2 in hopes that when I change movie2's width & height, movie3 will scale appropriately.

If it means anything, movie3 is in movie1's library, however, I've tried copying it to movie2's library and still no-go.

Help?

LoadMovie Vs. AttachMovie
Hey fellow flashers, I have menu on a site; the menu has 7 submenus, about 10k each. These menus combined make about 70k, so I've broken each up into separate .swfs and I have them load into level2 as they're called for, making for a faster-downloading site. My Question Is This: is it possible to do attachMovie instead, thereby eliminating the 7 extra .swfs and still keeping download time minimal? When you 'attachMovie' does it download as needed or is it preloaded? Thanks in advance. Lovelove, J_red

AttachMovie With LoadMovie
I have created two seperate .swfs that contain movies that I've exported in the libraries, thus the content mc's are available via attachMovie. I want to use this method so I can switch between libraries in a host mc. Unfortunately when I use loadMovie the attachMovie fails to work. I've seen a similar post somewhere but can't find it.

Does anyone have an example of using this method to create switchable graphics/sound libraries for example.

LoadMovie, AttachMovie, I Don't Know
Please help, I have been searching the boards for the answer, but cannot seem to get anywhere... I am trying to build my first ever site in flash and with the advice of a friend, have created several (45 to be exact) swf's. I want to use an XML navigation that Sephiroth built ( http://www.sephiroth.it/file_detail.php?id=97 ) but it calls for the swf's to be in the _root in order to link to a frame. How can I load all my swf's into the _root so that they can be called by:

TREE ACTION="FRAME" LINK="label" TARGET="_root.movieClip1">Goto Flash labeled frame</TREE

???

Can I preload all the swf files and then load/attach them to my main navigation swf so that they are in the _root?

Do I have to build all my swf's into 1 big file?

Any help would be appreciated.

Thanks

Attachmovie Vs. Loadmovie
Can someone explain me the difference between attachmovie and loadmovie?
I am working on a website and would like to know how to get it faster. Each swf that I want to load to the main movie is 400K.
Thanks

LoadMovie Vs. AttachMovie MX
Can you use the loadMovie action on a movie in the library using the linkage property or do you have to use attachMovie? I'd like to use loadMovie if posible without having to do it externaly. Thanks

AttachMovie() After LoadMovie()
Hello,

I have the following issue:-

i have scripted a movie on an setInterval() to dynamically movie.Image.loadMovie(jpeg) after a clearInterval I then had the movie movie.Image.attachMovie(movie) however I find that is does not attach the movie...now if i was to movie.attachMovie(movie) it does attach the movie thus removing 'Image' is there any rule about using loadMovie() and attachMovie() afterwards or anything that cause this issue?

LoadMovie Vs AttachMovie
Can someone describe the difference between loadMovie and attachMovie and why you would use one over the other?

thanks

LoadMovie & AttachMovie
Hey!

Im loading an external SWF movie into an blank mc_holder in my movie. From within that loaded movie I have an attachMovie call for a movieclip in the loaded movies libary. Thing is, it wont allow me to attach the libary movieclip to anywhere outside of the mc_holder.

Is there anyway around this? For the record its important for the SWF to be loaded into mc_holder but I might be open to other methods.

Thanks!!

LoadMovie After AttachMovie
Hi,

I am using attachMovie() to place several movieclips on the stage. I am then using loadMovie() to load a swf into each of these attached movieclips.

This is working OK, but when I try to send the loaded movies to a particular frame they just remain on frame 1. And if I trace the _totalframes on the loaded movies they return 1.

Is there some issue regarding loading movies into attached movies? The same thing happens if I use duplicateMovie() rather than attachMovie().

If I load the movie into a normal movieclip that is already on the stage it works fine.

Thanks in advance,

thesquirrel

PS I am using Flash 5

LoadMovie Vs AttachMovie
Hello,


From the main timeline and button action I use...

loadMovie("clip.swf", 100);//loads but, appear on top of my clip
attachMovie("clip", "_level300");//loads but; under the swf file.

When I load a movie then attach a clip from the library and even though I assgin a higer level to the attached clip, it still appear behind the loaded clip assigned a lower level. How can I place the attached movie ontop of the loaded swf movie.

Any help will be greatl appreciated


iaustin

AttachMovie With LoadMovie
I have a main movie which loads in a seperate .swf (let's call it gallery) using the loadMovie command. The problem is, gallery contains an attachMovie command which works when the movie is tested independently, but when gallery is loaded in to the main movie, attachMovie does not work. Is this a known issue or am I doing something wrong?

Thanks!

US Map Using LoadMovie And AttachMovie Q's?
Hello, this is my first time posting so if you need more info than i give, please let me know.
I have a flash movie that has the US map and when you click on each state it loads that state map. It works great for the 2 states that I have in so far but when I start loading the maps into the library the file is growing exponentially. So, I have decided to make every state map it's own .swf movie and load it when it is requested, as opposed to having them all in the main movie's library. From what i have read, loadMovieNum loads the movie on top of everything that is there, so the layering is not intact any more.
You can view my working movie with the three working maps here. Click on either Alabama, Arizona, or California.
The working movie uses this code:code:
//the var state holds the identifier of the movie i wish to play
_root.imageHolder.mtMovieClip.attachMovie(state, "newname1", 2)

You can view the non-working movie here.
The non-working movie uses this code: code:
//imageHolder is an MC placed on the main scene and it has many layers (map, bg, image, actions).
//in the image layer is a blank MC called myMovieClip and this is what I have the map loaded into using attachMovie
tellTarget("_root.imageHolder"){
this.createEmptyMovieClip(blankClip, 1);
loadMovie("california.swf", blankClip); }

I have also tried: code: tellTarget("_root.imageHolder"){
this.createEmptyMovieClip(blankClip, 1);
loadMovie("california.swf", blankClip);
_root.mtMovieClip.attachMovie(blankClip, "newname1", 2);}

It would be nice if you could make reccomendations of a better way to do this or how to make this work as it is.
Lastly, if you want to look at the .fla, just replace the .swf with .fla in your browser when viewing on the movies above.

Thank you

US Map Using LoadMovie And AttachMovie Q's?
Hello, this is my first time posting so if you need more info than i give, please let me know.
I have a flash movie that has the US map and when you click on each state it loads that state map. It works great for the 2 states that I have in so far but when I start loading the maps into the library the file is growing exponentially. So, I have decided to make every state map it's own .swf movie and load it when it is requested, as opposed to having them all in the main movie's library. From what i have read, loadMovieNum loads the movie on top of everything that is there, so the layering is not intact any more.
You can view my working movie with the three working maps here. Click on either Alabama, Arizona, or California.
The working movie uses this code:

code: //the var state holds the identifier of the movie i wish to play
_root.imageHolder.mtMovieClip.attachMovie(state, "newname1", 2)



You can view the non-working movie here.
The non-working movie uses this code:
code: //imageHolder is an MC placed on the main scene and it has many layers (map, bg, image, actions).
//in the image layer is a blank MC called myMovieClip and this is what I have the map loaded into using attachMovie
tellTarget("_root.imageHolder"){
this.createEmptyMovieClip(blankClip, 1);
loadMovie("california.swf", blankClip); }


I have also tried:
code: tellTarget("_root.imageHolder"){
this.createEmptyMovieClip(blankClip, 1);
loadMovie("california.swf", blankClip);
_root.mtMovieClip.attachMovie(blankClip, "newname1", 2);}


It would be nice if you could make reccomendations of a better way to do this or how to make this work as it is.
Lastly, if you want to look at the .fla, just replace the .swf with .fla in your browser when viewing on the movies above.

Thank you

AttachMovie Vs LoadMovie
ther is a weird thing happen when I use attachMovie action ;
I have several swf files that I load it randomly inside a main swf. to do this I used this code

ActionScript Code:
clipsArray = ["Tiger.swf", "Gazelle_MC.swf", "Peacock_MC.swf", "Bear_MC.swf"];
randInt = Math.floor(Math.random()*_root.clipsArray.length);
_root.question.loadMovie(clipsArray[randInt]);
_root.clipsArray.splice(randInt, 1);
that works very nice but by using a slow connection it takes a lot of time to load .
so I decided to use attachMovie and turn each swf to a MC in the main movie library.
so I change the previous code to this :

ActionScript Code:
clipsArray = ["Tiger.swf", "Gazelle_MC.swf", "Peacock_MC.swf", "Bear_MC.swf"];
randInt = Math.floor(Math.random()*_root.clipsArray.length);
_root.question.attachMovie(clipsArray[randInt]);
_root.clipsArray.splice(randInt, 1);


But somthing wierd happened somtimes the code works very well and somtimes it just stop I don't know why?
anyone know why that happened ??

Loadmovie With AttachMovie
Hi, I don't know if anyone else has had this problem, but i can't seem to solve it.
so i have a .fla and i'm loading an external swf into a movieclip that exisits on the first frame of the .fla file using movieClip.loadMovie. I want to attach a movieclip from the library of the .fla i'm working in to the movieClip that i'm loading the external swf into using movieClip.attachMovie. so the movieclip should appear on top of the external swf. is this possible?

Can You LoadMovie Then AttachMovie?
is there anyway to load an external swf for use with attachMovie? if so, do you have an example?

Thanks!

LoadMovie Or AttachMovie?
OK, so I've been out of this for awhile. Or maybe it's a brain fart. Either way I can't figure out how to automatically load an external swf (preload) and use it later on down the main timeline.

I tried:
loadMovie(external.swf, target mc) on frame one and then instanced a blank mc named 'target mc' on frame 5. And many permutations.

I also tried some onEnterFrame stuff.

Then I went the attachMovie route.

No go.

Wrong syntax maybe? Wrong method?

So, after two hours of searching I'm stumped. All I find seems geared toward progress bars. Not needed here. I'm just trying to do the same thing as one would in javascript where you preload images into the users cache so they're ready when called. Can this even be done?

Help.....Attachmovie() To Loadmovie()
HI all i needded some help with some coding that i am unable to figure out...
you see i have defined in a previous frame

Code:
_root.curenemno=1;
_root.curenem=[["clam",5]];
Then when as a current temporary sort of arrangement i attached this using the attachmovie function:

Code:
_global.enemies = _root.curenem;
_global.enDataArray = [[]];
popped = _global.enDataArray.pop();
trace(popped);
_global.fightphase = 1;
_global.enNum = _root.curenemno;
for (i=0; i<_global.enNum; i++) {
select = i;
enemy = _global.enemies[select][0];
tempAr = [select, _global.enemies[select][1]];
_global.enDataArray.push(tempAr);
_root.attachMovie(enemy, i, i);
with (_root[i]) {
_root[i].onPress = function() {
_root.curmon = this._name;
trace(_root.curmon);
this.onEnterFrame = function() {
_root.enemhp = _global.enDataArray[_root.curmon][1];
if (_global.enDataArray[this._name][1]<=0) {
_root.enemy = 'undifined';
_global.enNum--;
removeMovieClip(this);
this._visible = false;
}
};
};
_y = 100+(50*i);
_x = 100-(10*i);
}
}

The problem now is that i want to add a preloader to it a load it from an external source.I was hoping to use something like:

Code:
var enemycont:MovieClip = _root.createEmptyMovieClip("enemycont", _root.getNextHighestDepth());
var extenem:MovieClip = enemycont.createEmptyMovieClip("extenem", enemycont.getNextHighestDepth());
var mcLoader:MovieClipLoader = new MovieClipLoader();
var listener:Object = new Object();
listener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
progressperc = bytesLoaded*100/bytesTotal;
_root.loadedperc = progressperc;
_root.bar._xscale = progressperc;
_root.loader = bytesLoaded+" bytes of "+bytesTotal;

listener.onLoadComplete = function() {
_root.loader = "loaded";
gotoAndStop(3);
};
};
mcLoader.addListener(listener);
mcLoader.loadClip("external.swf", extenem);
Please help me..... I'm posting here as my only last resort..
Thanks in advance,
Avi

AttachMovie & LoadMovie
Flashers (scripters),

I am using the dragslidefade class (can't find the original URL, but if you want I can post the class). I want to be able to attach a movie and the use the class. Here's what's going on:

holder is in my library and linkage set to "holder"

Code:
MC.attachMovie("holder", "holder"+i, z, {_y:10+(150*int(z/4)), _x:(120*(z%4));
As you can tell, I'm using this method in order to make MCs dynamically in accordance with the amount of images in a mySQL database.

Now the class I'm using loads images this way

Code:
import com.dragslidefade.*;
var imageLimit:Image = new Image(nameofthemcwithlimits,1);

imageLimit.loadImage("products/photos/"+this.data.Image,true,false,true);
How do I get the attachMovie to use the class when loading the image?

AttachMovie Instead LoadMovie
Hi

I would like to change a working Script, switching from loadMovie to attachMovie.
Currently pictures are loaded as external files. I would like to keep the Transitions of the Gallery as they are, but having pictures loaded from library.
Is that possible?
What should be changed then?


PHP Code:



import mx.transitions.*; var picArray:Array = new Array("pic1.jpg", "pic2.jpg", "pic3.jpg", "pic4.jpg"); function setUpButtons():Void {     for (var i = 0; i<picArray.length; i++) {         var tempMC:MovieClip = this["BTN"+i];         tempMC.pic = picArray[i];         tempMC.onRelease = function() {             transOut(this.pic);             this.nextFrame();         };     } } function loadPic(pic:String):Void {     loader_mc.loadMovie(pic);     counter_mc = createEmptyMovieClip("c", getNextHighestDepth());     counter_mc.onEnterFrame = function() {         if (this._parent.loader_mc.getBytesLoaded() == this._parent.loader_mc.getBytesTotal()) {             delete this.onEnterFrame;             this._parent.loader_mc._visible = false;             transIn();         }     }; } function transIn():Void {     var myTM:TransitionManager = new TransitionManager(loader_mc);     myTM.startTransition({type:Iris, direction:0, duration:1, shape:"CIRCLE", startPoint:2, xSections:30, ySections:20, dimension:0, easing:easing.Strong.easeOut, shape:"CIRCLE"}); } function transOut(pic:String):Void {     if (loader_mc.getBytesTotal()>20) {         var myListener:Object = new Object();         myListener.allTransitionsOutDone = function() {             loadPic(pic);         };         var myTM:TransitionManager = new TransitionManager(loader_mc);         myTM.addEventListener("allTransitionsOutDone", myListener);         myTM.startTransition({type:Iris, direction:1, duration:1, shape:"CIRCLE", startPoint:2, xSections:30, ySections:20, dimension:0, easing:easing.Strong.easeOut, shape:"CIRCLE"});     } else {         loadPic(pic);     } } setUpButtons(); 




Thanks for help.

LoadMovie And AttachMovie
Hi, I don't know if anyone else has had this problem, but i can't seem to solve it.
so i have a .fla and i'm loading an external swf into a movieclip that exisits on the first frame of the .fla file using movieClip.loadMovie. I want to attach a movieclip from the library of the .fla i'm working in to the movieClip that i'm loading the external swf into using movieClip.attachMovie. so the movieclip should appear on top of the external swf. is this possible?

LoadMovie + AttachMovie
Is it possible to load a movie (loadMovie()) into an attached movie (attachMovie())? Essentially what I'm looking to do is load jpgs into a clip that has a registration point that is centered and at the bottom of the clip it loads into (for scaling reasons). My thought was to load the jpg into an attached movie that has the appropriate registration setting. But that isn't working for me. Any advice as to how I pull that off? TIA

Can You LoadMovie Then AttachMovie?
is there anyway to load an external swf for use with attachMovie? if so, do you have an example?

Thanks!

Loadmovie() Vs. AttachMovie()
After Rob set me straight below on how to effect loadtime of exported swf's, that brings me to a question about methodology. attachMovie() seems very easy to use - you can call, place, and dismiss any movie clip with this function - you just have to provide linkage info for the movieclip - exporting it.

But after reading the FlashMX Unleashed book, the seemingly preferred method is loadMovie(), which auto-places the movie on the top left 'unless' you create a container for it, place the container, and loadMovie() from within the container.

Which is best? Is there something wrong with building an entire site with attachMovie()?

Loadmovie/attachmovie Levels
Good day all,
here is the situation.
I have an external SWF loading with "loadmovie" to level 3.
I want a button click to load an MC located on the main timeline using "attachmovie" on top of the SWF sitting at level 3.
The MC does attach, but it loads underneath the SWF on level 3....in spite of the "attachmovie" loading it to level 5.

here is the code:

stop();
if (gototarget==3){
loadMovie("thestory.swf",3);
}
_root.attachMovie("ToErase","ToErase1",5);
ToErase1._x+=637.7/2;
ToErase1._y+=350/2;
eraselevel=ToErase1.getDepth();
thestory=_level3;

thanks for your help!

LoadMovie And AttachMovie Problem
I have a main swf.
From that swf I would like to load several other swfs that contain symbols exported for actionscript to be used with attachMovie().

I can load the movies just fine, but the symbols are lost and I cannot use attachMovie. I've tried loading into another level and into a symbol, but it's just not working.

Is this possible in flash MX?
If not is there any other alternative you can think of that might work (other than loading the symbols each time they need to be used, or using duplicateMovieClip)

thanks,
-matt

AttachMovie After LoadMovie's Done Loading?
Hi all. I've got this script on the end of a mc frame:

stop();

_root.loader.loadMovie("intro.swf"); //loads intro.swf into 'loader'
_root.loader._x=400; //then positiones it
_root.loader._y=80;

//I want this next part to load after the above is fully loaded in and playing

_root.attachMovie("text","text1","10"); //attaches 'text' to level10
_root.text1._x=200; //positions it
_root.text1._y=200;

What I'm wondering is if the external swf fully loads and then the attachMovie is executed or if the loadMovie starts to load the swf and the attachMovie is executed while the external swf is loading. This is going on the internet and I want it to load correctly on slower connections. When I tried the 'show streaming' option when previewing, it treated my file as if the external clip to be loaded was a part of the main movie. Hope this all makes sense. Thanks in advance.

LoadMovie, AttachMovie And Linkage
Can anyone help me with this?

I'm in the process of making a game in Flash MX. The way I've structured it, the game engine is located on _level0, and I use loadMovieNum to load a scenario (set of cutscenes, character graphics etc) into _level1.

So the game engine (gameeng.swf) does...


Code:
loadMovieNum("scenario.swf",1);
and then the scenario.swf does something like


Code:
_level0.board.creategrid(10,6);
_level0.board.createchar("Evelyn",0,0);
_level0.board.createchar("allison",1,0);
_level0.board.createchar("alex",2,0);
to set up the graphics, character positions etc for this scenario.

The problem I currently have is using attachMovie to create a new character (like so)


Code:
attachMovie(name+"Sym",name,characters+100);
(where the movie clip linkage name is something like "allisonSym" and this is called from a function on _level0)

This works if the symbol is in gameeng.swf's library, but never does if it's in the scenario's library. Given that I'd want the scenario-unique symbols to be in the scenario.swf file, this is a little bit of a problem.

Can anyone tell me how to fix this? How can I link correctly to an object in _level1's library from _level0?

Thanks

SetMask On LoadMovie Vs AttachMovie?
How do i explain this?....

ok, i have an image in the library, and i set linkage with the name "theImage"
in my script, i attachMovie(theImage, "puzzlePiece", 20); I can then setMask() using another MC as the mask over this image, and everything is groovy... a puzzle piece with my image on it.

my problem is, i can't use attachMovie anymore, because i need the client to pop images up onto the server and have the swf pull them in and apply the mask like before. this doesn't seem to be working. Is it not possible to create an MC using loadMovie and setMask over that MC?

please help, any info would be welcome... even "it can't be done" thanks... Ku

LoadMovie (Preloader (or Any AttachMovie))
Hey all,


Right heres another thing thats getting to me, i dont need help with code as such but again theory.

Ok heres the situation.

Movie1.swf (_root)
_root.blah

movie2.swf


_root.blah.loadMovie ("movie2.swf");


Ok so if you follow that, movie2 unless i understand wrong, has essentially lost its swf status and became _root.blah?

Anyways, thats not the point, the point is, i want to attach this preloader to the first frame of my newly loaded file. So how would i do that?

See im not even sure if this is the way its done, perhaps you dont/cant attach the preloader to an external swf. In that case, do you just fake a preloader to appear over where you want to load in your content and use _root.blah._getFramesTotal;

Obviously i dont know if you can do that yet. Its just i dont really want to spend hours trying things when i dont have the full understanding first. Then it wont bother me!

Thanks

ps i know theres lots of preloader topics, but i really cant find a clear explaination of how loadMovie works with preloaders. I searched Generic Preloader but just didnt understand.

AttachMovie & LoadMovie With Link
Hello Flashkit,


I have been working on this all day. I am pretty new at AS and could use some help.

I have a attacheMovie and a loadMovie and when I put a onRelease function on it, it does not seem to work. If I take out the loadMovie line it will draw the boxes and the onRelease funtion then works. I assume my problem is that when I do the loadMove it replaces everything that was there before. So what am I missing to get this working.

myXML = new XML();
myXML.ignoreWhite='ture';
myXML.onLoad = function(ok) {
if (ok){

allData = this.firstChild.childNodes;
//get the images
for(i=0; i<allData.length; i++){
newButName = 'but'+i;
scrollButton=_root.attachMovie('but_holder',newBut Name,i);
//scrollButton.loadMovie("clientImages/" + allData[i].firstChild.firstChild + ".jpg");
scrollButton._y=165;
scrollButton._x=i*178;
scrollButton.onRelease=function(){
trace('hi');
}

}

}else{
trace('Failed');
}
}
myXML.load('xml/clients.xml');

stop();


Thanks

LoadMovie And AttachMovie Depths
hallo all

i try to use loadMovie and attachMovie depths in relation to eachother with no luck. i want to attach a movieclip to, say, depth 5 and load a movie clip "under" it at depth 2.

any ideas?
thnx in advance
spiros

[F8] AttachMovie (loadMovie) Problem
I have made a quiz that takes place inside of an e-learning. I have a correct and incorrect movie to be shown after the learner has selected an answer for a question. i am running into a problem with the answer not being shown for the first question, even though it shows for other questions, with essentially the same code (i just cut and paste the code, changing a variable number in the middle...). can anyone show me where i might've gone wrong? i attached the fla file if further reference is needed....




Code:
function question1() {
//set the question type
multipleChoice();
//show the question number
currentQuestionText.text = currentQuestion;
//set the question and distractor text
questionText.text = "hello baby";
answerAText.text = "This is the first response";
answerBText.text = "This is the second response";
answerCText.text = "This is the third response";
answerDText.text = "This is the fourth response";
answerEText.text = "This is the fifth response";
//set the correct answer
multCorrectAnswer = "A";
//set the feedback answer for the question
correctFeedbackMovie_mc.feedbackHouse_mc.attachMovie ("correct1_mc", "correctshow");
incorrectFeedbackMovie_mc.feedbackHouse_mc.attachMovie("incorrect1_mc", "incorrectshow");
//if needed, turn on the picture box and load an image for the question
questionPictureBox_mc._visible = false;
questionPictureBox_mc.loadMovie ("");
}

How To Do SetMask With AttachMovie&loadMovie?
I wanna make a mask to cover the edges of a smaller swf played in a bigger swf. And here's the code in the bigger one's fla. before adding any mask:

_root.sit_btn.onPress=function () {
_root.attachMovie("zSq", "sit_mc", 500);
sit_mc._xscale= 70;
sit_mc._yscale= 70;
sit_mc._y=30;
sit_mc._x=80;
loadMovie("sit.swf", sit_mc);
}

And then I add
sit_mc.setMask(mask); in the {}
-->mask, the instance name of the mask
I'm not sure that's how you do it, but it doesn't work.
And a stupid question: if the small swf is 386X280 px, and that's the only area I wanna show, how big my mask have to be?


Thanks!

LoadMovie And AttachMovie To The Same Movieclip?
Hi,

I have a movie clip on a separate layer in my main file. I want to load a .swf file into that movie clip and then attach movies to it from the library.

Specifically I want to load an extern .swf file that is a background movie and then attach avatars from the library to display on top of the background. I want to have everything in the same movie clip space because different things happen when I click on an avatar vs. clicking on the background.

Here's an example:
game - my empty movie clip
background.swf - the external .swf movie
avatar - a library movie clip (sprite)

code:
_root.game.loadMovie("background.swf", 1); // I've tried all kinds of depths
_root.game.attachMovie("avatar", playerName, playerDepth); // playerName and playerDepth change for each new avatar

what shows up is just the background.swf and no avatars.

I can easily attach (using attachMovie) multiple avatars to "game" and they all show up. I can also load (using loadMovie) background.swf to "game" and it shows up. However, when I try to do both the avatars refuse to show up.


1) Is what I'm doing not possible?
2) Am I just screwing up the movie load layers?
3) If it's not possible does someone have another way to accomplish my goal?


I can create another layer in the main file with another empty movie clip say "background" and then load the backgroup.swf into "background" and load the avatars in "game". But.... when I click on the avatars it sends the mouse click down to the background movie. I don't want that. I want to click on either the avatar to do something or the background to do something, not both.


Whew. long first post but I would GREATLY appreciate any help/advice/suggestions! Thanks!!!

AttachMovie And LoadMovie Quickie
Is it possible to attach a movie clip to a movie that has been loaded via loadMovie?

Would Like To Replace AttachMovie With LoadMovie
Little bit stuck here,

My code with attachMovie works


Code:
function showNextNav(selected, clip) {
pClip = clip[selected[currentNav]];
trace("test "+pClip);
pClip._alpha = 100;
delete onEnterFrame;
pClip.swapDepths(setDepth(1));
pClip._alpha = 0;
currentNav = (currentNav+1)%(selected.length);
trace("current nav "+currentNav);
onEnterFrame = function () {
if (pClip._alpha<100) {
pClip._alpha += 10;
} else {
delete onEnterFrame;
}
};
}
function showPortfolio(selected, clip, xValue, yValue) {
this.clip.removeMovieClip();
var clip = this.createEmptyMovieClip("clip", 10);
clip._x = xValue;
clip._y = yValue;
for (i=0; i<selected.length; i++) {
trace("This array length "+selected.length)
clip.attachMovie(selected[i], selected[i], setDepth(i));
clip.selected[i]._alpha = 0;
}
portfolioInterval = setInterval(this, "showNextNav", 4000, selected, clip);
}
But now I want to replace

Code:
clip.attachMovie(selected[i], selected[i], setDepth(i));
with load movie


Code:
clip.loadMovie(baseDir+selected[i]);
It loads the first .jpg but it doesn't show the others???

Any pointers??

Trying To Replace AttachMovie With LoadMovie?
Hi there,

Really stuck here.

I first made my movie with attachMovie and it worked. Now I noticed it becomes to large in filesize so I want to load the images when they are needed.

But now my simple fade doesn't work??? See .zip

I think it has to do with showNextNav(selected, clip);

Code:
function showNextNav(selected, clip) {
//pClip = clip[selected[currentNav]];
pClip = clip;
trace("tes "+pClip);
pClip._alpha = 100;
delete onEnterFrame;
//pClip.swapDepths(setDepth(1));
pClip._alpha = 0;
currentNav = (currentNav+1)%(selected.length);
trace("current nav "+currentNav);
pClip.onEnterFrame = function () {
if (pClip._alpha<100) {
pClip._alpha += 10;
} else {
delete onEnterFrame;
}
};
}
which is called by

Code:
function showPortfolio(selected, xValue, yValue) {
this.clip.removeMovieClip();
var clip = this.createEmptyMovieClip("clip", 10);
clip._x = xValue;
clip._y = yValue;

for (i=0; i<selected.length; i++) {
clip.createEmptyMovieClip("clip"+i, i);
trace("This array length "+selected.length);
//use attachmovie
//clip.attachMovie(selected[i], selected[i], setDepth(i));
//use loadmovie
clip["clip"+i].loadMovie(baseDir+selected[i]);
clip["clip"+i].setDepth(i);
clip["clip"+i].selected[i]._alpha = 0;
}
portfolioInterval = setInterval(this, "showNextNav", 2000, selected, clip);//<---------I think I must somehow show next i???
}
any suggestions???

AttachMovie, LoadMovie, MovieClipLoader, Etc
Hi -
I'm working on a project showing some video clips. I've converted the video clips to FLV and put each FLV into it's own SWF . Now I want to bring the separate SWFs into a "master.swf", which has a placeholder_mc, on demand. There will be a text list OR a series of buttons that the user will use to select which video clip they want to see and therefore which SWF should be loaded into the master placeholder.

Here's the question:

What is the best Actionscript way of bringing SWFs into that master placeholder?

I've seen tutorials using attachMovie, loadMovie or MovieClipLoader (and a few more) and, since I don't know what I'm doing anyway, I'm not sure which way to go...or whose advice to follow.

Can someone please clear this up for me or point me to a good compare/contrast article?

TIA your assistance.
JL

LoadMovie / AttachMovie Error
Hi All, First post

I've got a swf that sorts out all the sounds for the master movie, this swf is loaded in and works just fine, except none of the actual sounds are attached from the library. Works fine on its own, but as soon as it's inside another swf the sounds fail to attach. I know that other people have had simialr problems, but as far as I can see I'm not using root anywhere, is it possible to somehow specify which library to attach from?

The code I'm using is below.....

//setup all sounds
soundArray = new Array("arctic_wind", "cheer");
//
for (i=0; i<soundArray.length; i++) {
this.createEmptyMovieClip(soundArray[i]+"Holder", i+1000);
this[soundArray[i]+"Sound"] = new Sound();
this[soundArray[i]+"Sound"].attachSound(soundArray[i]);
}
stop();
//test - plays fine on it's own. does not play when loaded into another movie
trace("sounds created");
this.arctic_windSound.start();
trace (arctic_windSound.position);

Please help,

Jules

AttachMovie-LoadMovie-setMask...help
I have a movieclip ("thumb") whith 2 layers. In the top layer a movieclip to be used as mask ("foto_mascara") of the bottom layer movieclip ("foto_contenedor") and try this:

_root.attachMovie("thumb","thumb2",_root.getNextHi ghestDepth ());
nueva_foto=eval("thumb2");
loadMovie(fotos[i],nueva_foto.foto_contenedor);
nueva_foto.foto_contenedor.setMask(nueva_foto.foto _mascara);

but the problem is that the "foto_contenedor" movieclip shows the entire image under the "foto_mascara" movieclip.

And if i do this ,the mask works right:

_root.attachMovie("thumb","thumb2",_root.getNextHi ghestDepth ());
nueva_foto=eval("thumb2");
nueva_foto.foto_contenedor.createEmptyMovieClip("f oto",nueva_foto.foto_contenedor.getNextHighestDept h());
loadMovie(fotos[i],nueva_foto.foto_contenedor.foto);
nueva_foto.foto_contenedor.setMask(nueva_foto.foto _mascara);

is that the way to do it?...creating an empty movieclip inside the container?...

Switching Between LoadMovie And AttachMovie
having some trouble with a holder mc that loading content either by attachMovie or loadMovie depending on a conditional. it's working intermittently though. this is all within a for loop loading an xml file. if sizeName == half and then the next item is sizeName == half, the content doesn't load. one more click and it loads though. or it works if i go from a sizeName == full to a sizeName == half.

thanks!


Code:
curr_item.onRelease = function()
{
if (this.sizeName == "half")
{
holder_mc.createEmptyMovieClip("holder2", 1);
holder_mc.holder2.attachMovie("content", "content_mc", 1);
holder_mc.holder2.content_mc.contentImage_mc.loadMovie(this.image);
holder_mc.holder2.content_mc.contentTitle_txt.htmlText = this.name;
holder_mc.holder2.content_mc.contentDesc_txt.htmlText = this.desc;
}
if (this.sizeName == "full")
{
holder_mc.createEmptyMovieClip("holder2", 1);
holder_mc.holder2.loadMovie(this.image);
}
};

Complex LoadMovie To AttachMovie
I have a perfectly working script that loops though an array and pumps out as many dynamically created blankMovieClips as needed. Then I have a loadMovie command that loads an external swf in to all of the blankMovieClips. Check it:


ActionScript Code:
_root.loadbanner_mc.createEmptyMovieClip("banner"+i, i+3);loadMovie("DB.swf","_root.loadbanner_mc.banner"+i);

What I would like to do is change my load approach and use the attachMovie command. Can someone help with the difference between the two commands? How can I do the same thing with the attachMovie command?

I am hoping this will decrease fill size an increase performance. I am loading 30 to 40 clips that are 10k each. That adds up fast for a modem.

Attachmovie + Loadmovie = Problem
I have a button with code:

on (release) {
attachMovie("xokno", "okno1", 800)
loadMovie("smaz.swf",_level800.okno1) //it does not work!

//change width of instance window1. This instance is in smaz.swf file
_level800.okno1.window1._width = 500

trace ("xxx"+_level800.okno1.window1._width) //it write just xxx, _level800.okno1.window1._width but it is empty...
}

I just want to make a movie clip "okno1" in dept 800. And then load smaz.swf movie into this clip - okno1. After that I want to change width of window1 clip - this clip is in smaz.swf file. But It does not work. Why???

Please help me - post there or send me (j.recina@sh.cvut.cz) a correct code. thx

Camron

LoadMovie And AttachMovie Question
I never see the "b" clip loaded. Is it because the loadMovie clip is hiding it? I thought since I have the "map_mc" on level 5 and the "b" clip one higher it would show both clips. Thanks.


ActionScript Code:
zoom_mc.createEmptyMovieClip("map_mc", 5);
zoom_mc.map_mc.loadMovie("someclip.swf");
zoom_mc.map_mc.attachMovie("a", "b", zoom_mc.map_mc.getNextHighestDepth());

AttachMovie Faster Than LoadMovie?
I used this attachMovie code. Its very fast.
But I want my objects importing out my swf. For this reason, I used loadMovie code. But although I m working in localhost Its very slow. I mean Its delaying for a miliseconds.

Any solutions for this problem?

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