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




Attaching Movies/images To A Specific Frame



Hi,

As far as I know, attaching movies/images, using attachMovie for internal elements, or loadMovie for external ones, always attaches it to the first frame.

So what if I want to attach something, let's say, to the second frame? Is it possible to do?

What I need to do is to dinamically build an animation on a movieclip with external images, so some images go to the 1st frame, and other go to other frames.

How can I do this with AS?

Best regards.




View Complete Forum Thread with Replies

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

Attaching Multiple Movies Not Showing Images
Hi There,

I'm using Flash 9.0 and i'm trying to attach multiple jpg files to my movie. Everything seems to work up to the point where I try to attach the movies. I'm trying to get a table like layout of thumbnail images on the screen.

like: image | image | image

Can someone help me fix the code please?

Thanks in advance


!------------ trace

pages/page01.jpg
Target not found: Target="page00" Base="_level0"
pages/page02.jpg
Target not found: Target="page01" Base="_level0"
pages/page03.jpg
Target not found: Target="page02" Base="_level0"
pages/page04.jpg
Target not found: Target="page03" Base="_level0"
pages/page05.jpg
Target not found: Target="page04" Base="_level0"


!--------------------------------


myBook.enabledProp = false;
_root.attachMovie("thumbOverlay","thumbOverlay_mc" ,1000);
thumbOverlay_mc._x = 200;
thumbOverlay_mc._y = 300;

var ALLXML = myBook._cache.extXML;

var imageURL;
var imgIndex = 0;
var pages:Array;

var numimages = myBook.pagesSet.length;

var pgenodes = ALLXML.firstChild.childNodes[19].childNodes;


for (i=0; i< pgenodes.length; i++) {
var thePath = pgenodes[i].firstChild;

trace(thePath);

thumbOverlay_mc.attachMovie("page"+i,"page"+i,i,{_ x:0, _y:0});


loadMovie(thePath, "page"+i+".loadhere");

tellTarget ("page0"+i) {


}

Attaching Movies To Export In First Frame
Does nayone know of a way to make an attached movie export in any other frame but frame 1.

How Do You Test Movies From A Specific Frame?
How do you test movies from a specific frame?

Loading Movies To A Specific Frame
Is it possible to load in a movie to a specific frame? I am currently loading a movie from a button with:
on (release) {
unloadMovieNum(1);
loadMovienum("Is.swf",0);
}

This works perfect, but I'd like to add usablility by directing the button to a specific frame within that new movie. I've tried:
_level0.gotoAndPlay(10);
after loadMovienum in the previous code but it doesn't do anything different. The movie always starts up on frame 1.

In the end I'd like to have multiple buttons serving as navigation buttons specifying different frames of the new movie.

Am I close or is this not even possible? Thanks!!

Loading Movies To A Specific Frame
Is it possible to load in a movie to a specific frame? I am currently loading a movie from a button with:
on (release) {
unloadMovieNum(1);
loadMovienum("Is.swf",0);
}

This works perfect, but I'd like to add usablility by directing the button to a specific frame within that new movie. I've tried:
_level0.gotoAndPlay(10);
after loadMovienum in the previous code but it doesn't do anything different. The movie always starts up on frame 1.

In the end I'd like to have multiple buttons serving as navigation buttons specifying different frames of the new movie.

Am I close or is this not even possible? Thanks!!

If Timeline Came From (specific Frame Of Any Scene), Go To (specific Frame)
Hi, I have thirteen scenes, each one has 2 frames, one with audio (loadSound) one without. What's the best way to tell flash when a user clicks on a nav button (which calls a scene) to go to the 1st or 2nd frame of the scene depending on if the previous scene was playing the 1st or 2nd frame?

Thanks in advance.

Loading Specific Frames Within Specific Movies
Ok guys.. cutting to the chase, Basically im loading a movie externally using this code...


Code:

on (release) {
if (S_Init == Number(S_Init)) {
loadMovieNum("s_menu.swf", _root.S_Init);
} else {
_root.S_Init.loadMovie("s_menu.swf");
}
// End Behavior
}
which then loads the movie into the specified movieclip (S_Init).

I would like to load a particular frame of that movie's main timeline (s_menu.swf). How would I modify this code to do such.

Thanks
-Blackfire

Loading Specific Frames Within Specific Movies
Ok guys.. cutting to the chase, Basically im loading a movie externally using this code...


Code:

on (release) {
if (S_Init == Number(S_Init)) {
loadMovieNum("s_menu.swf", _root.S_Init);
} else {
_root.S_Init.loadMovie("s_menu.swf");
}
// End Behavior
}
which then loads the movie into the specified movieclip (S_Init).

I would like to load a particular frame of that movie's main timeline (s_menu.swf). How would I modify this code to do such.

Thanks
-Blackfire

Attaching External Swf To Specific Time Of Day
I'm trying to get a specific external swf to load depending on what time of day it is according to UTC. I can't seem to get the conditions to work at all.
--------
myday = new Date();
day = myday.getDay();
hours = myday.getUTCHours();
this returns the right number, in this case 0 for sunday but...
when I change what day equals in the if statement it returns whatever I put in.
so...
if (day = 0) {
gotoAndStop(2);
}
returns 0
but...
if (day = 1) {
gotoAndStop(2);
}
returns 1
why are my "if" statements returning the condition I set rather than running the gotoAndStop statement???

the other thing is that if I use the variable "hours" instead of "day" it works fine. I also tried .getUTCDay()instead of .getDay()

if I only needed to base it on .getUTCHours() that would be fine but I need both conditions for both day of the week and time of day.

if anyone can help me or direct me to an swf or tutorial I can look at I would appreciate it.

Attaching External Swf To Specific Time Of Day
I know it's something simple but I just started doing this again and it just isn't coming to me.
This is the whole code...

in the first if statement I've used both bitwise and logical operators aswell as = and == I've also used ">""<" to set the conditions. everytime it shows the first movie no matter what I change. I've tested the above combinations with the corresponding times below to test but it always comes up with the first movie "ryan.swf". I understand it's like taking a child through his first math class but any help you guys can give I'd really appreciate it.

stop();
mytime = new Date();
day = mytime.getDay();
hours = mytime.getUTCHours()+8;
trace(day);
trace(hours);
if (day>0<6) {
if (hours == 6 || 7 || 8 || 9 || 10) {
loadMovie("ryan.swf", this);
} else if (hours>9<13) {
loadMovie("steve.swf", this);
} else if (hours>11<16) {
loadMovie("michael.swf", this);
} else if (hours>14<19) {
loadMovie("cesco.swf", this);
} else if (hours>17<20) {
loadMovie("dave.swf", this);
} else if (hours>18<22) {
loadMovie("sarah.swf", this);
} else if (hours>20<=24) {
loadMovie("rob.swf", this);
} else if (hours>=0<7) {
loadMovie("jim.swf", this);
}
} else if (day == 7) {
if (hours>5<11) {
loadMovie("chris.swf", this);
} else if (hours>9<12) {
loadMovie("kids.swf", this);
} else if (hours>10<16) {
loadMovie("bruce.swf", this);
} else if (hours>14<19) {
loadMovie("jesse.swf", this);
} else if (hours>17<23) {
loadMovie("jeromechris.swf", this);
} else if (hours>21<=24) {
loadMovie("group.swf", this);
}
} else if (day == 0) {
if (hours>=0<3) {
loadMovie("group.swf", this);
} else if (hours>1<7) {
loadMovie("sky.swf", this);
} else if (hours>5<11) {
loadMovie("rob.swf", this);
} else if (hours>9<12) {
loadMovie("kids.swf", this);
} else if (hours>10<15) {
loadMovie("ryan.swf", this);
} else if (hours>13<16) {
loadMovie("sarah.swf", this);
} else if (hours>14<19) {
loadMovie("michael.swf", this);
} else if (hours>17<22) {
loadMovie("jeff.swf", this);
} else if (hours>20<=24) {
loadMovie("group.swf", this);
}
}

Attaching External Swf To Specific Time Of Day
I'm trying to get a specific external swf to load depending on what time of day it is according to UTC. I can't seem to get the conditions to work at all.
--------
myday = new Date();
day = myday.getDay();
hours = myday.getUTCHours();
this returns the right number, in this case 0 for sunday but...
when I change what day equals in the if statement it returns whatever I put in.
so...

Code:
if (day = 0) {
gotoAndStop(2);
}

returns 0

but...

Code:
if (day = 1) {
gotoAndStop(2);
}

returns 1

why are my "if" statements returning the condition I set rather than running the gotoAndStop statement???

the other thing is that if I use the variable "hours" instead of "day" it works fine. I also tried .getUTCDay()instead of .getDay()

if I only needed to base it on .getUTCHours() that would be fine but I need both conditions for both day of the week and time of day.

if anyone can help me or direct me to an swf or tutorial I can look at I would appreciate it.

Specific Html Page Triggers Specific Frame Of The Flash Movie
I have been playing with flash and html and wonder if any of you have a bright idea on how to do this.


I have a flash movie, which I call from html but depending on which part of the html page I call it from I want to start it at a particular frame and not always from the beginning.

I have created a variable within the movie in action script and given it a different value for each of the frames I want to start the movie at, and want now to designate the value I give to that within html so that the movie “jumps” to the correct frame. Is this possible or am I totally crazy??

Attaching A Clip To A Specific Position On Stage
I am attempting to attach a MC to a specific position on the stage(flash 5 )after the mouse is pressed. the background is a button and I can attatch the clip to the center(a BG layer is a MC) but not to the X-Y position where the mouse is last clicked. Can anyone tell me how to code this. For eg I have a gun that is a custom cursor and when it clicks anywhere on the background(button) it fires the sound and attatches a bullet hole MC to a MC that is the same size as the backgound,behind the BG button. It does this, now but smack in the middle by default? any suggestions?

Attaching Multiple Images - Load Images One At A Time?
I have a photo gallery that loads many images using a for loop (image data is from XML file). Simplified code looks like this:


Code:
var photos_xml = new XML();
photos_xml.ignoreWhite = true;
photos_xml.onLoad = function(success) {
if (success) {
var photos = photos_xml.firstChild.childNodes;
var itemCount = 0;
for (var i = 0; i < photos.length; i++) {
var path = photos[i].attributes.path;
// attach the photos
var photo_mc = _root.center_mc.photosLevel1_mc.attachMovie("photoFrame_mc", photoName, itemCount);
photo_mc.empty_mc.loadMovie(path);
itemCount ++

...
Then on the photoFrame_mc clip I have a loading like:


Code:
onEnterFrame = function () {
loader_mc._visible = false;
var t = empty_mc.getBytesTotal();
var l = empty_mc.getBytesLoaded();
percent = Math.round((l / t) * 100);
if (l == t && t != undefined && t > 10) {
loader_mc._visible = false;
delete this.onEnterFrame;
} else {
loader_mc._visible = true;
if (isNaN(percent)) {
percent = 0;
}
loader_mc.percent_txt.text = 10 - Math.round(percent / 10);
}
};
So what happens now is that many images get attached at once and they are all loading at the same time.

What I'd like to do instead is to have them load one at a time. The first pass through the for loop attaches an image and then it loads, but it doesn't move on to the next image until the first one is done loading. Is that possible?

Or maybe is it better to let them load all at once? I just think that when the image count is very large it will really bog down loading so many images at once and it might be best to load one at a time. Please advise.

How To Load Specific Frame Of Specific Movie On Another Layer
Here's my setup:

Layer 0 = main movie

Layer 1 = navigation movie

Layer 2 = products.swf


Using a button located on Layer 1 (that contains navigation.swf), I need to load on Layer 2 the products.swf, and it needs to land on frame 54 of that movie.

I'm fairly illiterate r.e. ActionScript, so go gentle on me, please, LOL

Thanks!!!!!

Attaching Movies From Attached Movies
Hi I'm trying to attach a movie from another attached movie but having problems.

I'm generating a bunch of lockers using a for loop and they are being attached to an empty mc called lockergroup, passing the initobject so I can get locker numbers on the lockers.

Then when you click on one of these lockers I'm trying to attach a "large open locker" movie above all of the other generated lockers, but it's not going to the highest level no matter what I try to use (_root.getNextHighestDepth(), etc). I need to use attach instead of load so I can pass the locker number to the open locker mc. Anyone have any ideas on how to pass the locker number or bring the open locker mc to the front?

thanks

Attaching Movies
Ok, I've a big problem with the method .attachmovie
I tried some settings, but it seems that this method works only with objects (correctly concatenated with an IDname) in the same level of the target movie.
This is what I would make:
- In my main timeline, I create an empty movieclip
- I Make an external swf with some objects concatenated with an IDname
- I Load this external swf on _level1 of my main timeline
- From _level1 I wish to attach one of my concatenated objects to the empty movieclip on _level0, but it doesn't work !!!!


HEEELP MEEEEE

Attaching Movies
This is probably a newbie question but I tried to work it out myself to no avail so here it is.

I've got a a bunch of buttons and a picture tv screen above them. I've also got a bunch of movie clips with words that fade in (meant to be placed on the tv screen) when the mouse goes over the corresponding button.

Say I wanted a movie clip of the words fading in (exported with "wHome" as the identifier) to play when the mouse goes over the home button and to dissapear when the mouse rolls out, what would the action script look like?

Thanks in advance.

-Tom

BTW, I'm using Flash 5.

Attaching Movies
got this code (shown below) attached to a movie clip called bottle_mc which is contained in another movie clip called map_mc. It says there are no errors but it wont load the movie clip letter_mc like i want it to - anyone no whats wrong with it? also, anyone no what the number 1 after the two "letter_mc"'s in the brackets means?

on(press) {

_root.attachMovie("letter_mc", "letter_mc", 1);

with(_root.letter_mc) {

_x = Stage.width/2;
_y = Stage.height/2;

};

_root.stop();

}

Attaching Movies
Hello,

I’m attaching movies (mcButton) to a “movie container” (mcMovieContainer). The attached movie has a Dynamic Text field to which I want to change the text, I’m using the code below but it is not working. I can attach the movies but I can’t change the text. How can I do that?

btnAdd.onRelease = function() {

mcMovieContainer.attachMovie("mcButton", "mcButton"+i, mcMovieContainer.getNextHighestDepth(), {_y:50*i+5, _x:5});

mcMovieContainer.mcButton[ i ].txtCaption.text = "Caption Text Here"

i++;

};

Thank you in advanced,

Attaching Movies
I am having problems accessing a button after I have attached it to the stage from the library...

My code is as such:

map_mc.onRelease = function(){
empty_mc.attachMovie("map_functions","map_close",t his.getNextHighestDepth());
}
empty_mc.map_close.close_mc.onRollOver = function(){
this.colorTo(0x20AEAE,1.5);
}

On the rollover - the movie recognises nothing as executable.

OK >> Yes - I have linked in the properties, an identifier for AS Export .. for the original map_functions, inside it is an MC called close_mc - This MC is linked for AS Export as close_mc

....Why is this not working?

PS. the function calls are from Lacos Tween engine.

Any Advice would be great ...

Attaching Movies Issue.. Please Help
I am attaching approximately 10 items... however if I run a function and then run a seperate function attaching a couple of other movies... my initial movies dissapear... they are all reletavely close and are supposed to create a grid like pattern... whats going on...

Thanks,
Carlos

This code might not make anysense but here it is...

code:
function OnVelcroCreate() {
HHValue = (HorizHook.getValue());
VHValue = (VertHook.getValue());
VLValue = (VertLook.getValue());
HLValue = (HorizLoop.getValue());
if ((HHValue || VHValue || VLValue || HLValue)>0) {
velcrolinecreation();
}
function velcrolinecreation() {
x_stage_pos = 34;
y_stage_pos = 106;
box_width = 27;
box_height = 27;
ypos = 0;
multiplier = 1;
for (i=1, j=0; i<=HHValue; i++, j++) {
// attach Horizontal Dashed Line graphic movie clip from the library.
attachMovie("HDash", "HDash_" add i, i);
mc = _root["HDash_" add i];
setProperty("HDash_" add i, _x, box_width*j+x_stage_pos);
setProperty("HDash_" add i, _y, ypos+y_stage_pos);

if (i == (1*multiplier)) {
j = -1;
ypos = box_height*multiplier;
multiplier++;
}
}
x_stage_pos = 34;
y_stage_pos = 106;
box_width = 27;
box_height = 27;
ypos = 0;
multiplier = 1;
for (i=1, j=0; i<=VHValue; i++, j++) {
// attach Vertical Dashed Line graphic movie clip from the library.
attachMovie("VDash", "VDash_" add i, i);
mc = _root["VDash_" add i];
mc.label.text = name;
_root["VDash_" add i].labeler = name;
setProperty("VDash_" add i, _x, box_width*j+x_stage_pos);
}
x_stage_pos = 47;
y_stage_pos = 106;
box_width = 27;
box_height = 27;
ypos = 0;
multiplier = 1;
for (i=1, j=0; i<=VLValue; i++, j++) {
// attach Vertical Solid Line graphic movie clip from the library.
attachMovie("VLine", "VLine_" add i, i);
mc = _root["VLine_" add i];
setProperty("VLine_" add i, _x, box_width*j+x_stage_pos);
setProperty("VLine_" add i, _y, ypos+y_stage_pos);
}
x_stage_pos = 34;
y_stage_pos = 119;
box_width = 27;
box_height = 27;
ypos = 0;
multiplier = 1;
for (i=1, j=0; i<=HLValue; i++, j++) {
// attach Horizontal Solid Line graphic movie clip from the library.
attachMovie("HLine", "HLine_" add i, i);
mc = _root["HLine_" add i];
setProperty("HLine_" add i, _x, box_width*j+x_stage_pos);
setProperty("HLine_" add i, _y, ypos+y_stage_pos);

if (i == (1*multiplier)) {
j = -1;
ypos = box_height*multiplier;
multiplier++;
}
}
}
}

Loading/ Attaching Movies
Hiya

Having looked through the board topics I can't find an answer that suits for a very simple question!

I am using Flash MX 2004 with Actionscript 2.

Right I have a movie clip with an instance name of Tracing.

when I do
Tracing.loadMovie(name,"Tracing");
it loads the named clip, but turns the background black so I can't see it properly and makes it way too big. So how do I load the movie clip into the specified area and keep the clip as it was i.e. black image on a white background??

What I am eventually aiming for is to load an image of a shape, e.g. a square and letting a user trace it with the mouse, so their lines drawn with the mouse go over the image. Hope that makes sense.

If anyone can help, please do as I am going loopy.

thanks in advance
nottsShark!

Attaching 2 Movies To Play One After The Other
i guess this is fairly simple but i can't do it..


I've used attachMovie to play a movieclip and i want a second to be attached as soon as the 1st one finishes.

cheers.

Probs With Attaching Movies
(Flash 6)

I'm using this code to attach the "flower" movie clip 10 times to the movieclip called "holder". Instance names shall be f1, f2, f3 ... f10:

Code:
for (i=0; i<10; i++) {
insta = "f"+i;
holder.attachMovie("flower", insta, i);
holder.insta._x = random(512);
holder.insta._y = random(512);
trace(insta);
trace(holder.insta._x);
}
The attaching itself works fine. But the ._x and ._y dont work.
The trace(holder.insta._x); returns undefined.

My guess is, thats because my variable "insta" is a string (needs to be a string to attach), and pathing doesnt work with strings.

Does anyone know how I could solve that problem?

Attaching Movies And Removing Them
Hello!

Im having ome issues with my attach movies and deleting them.

I can do it once, but then, if i use the function again they pop up but cant make them delete again.

POP > DELETE > POP > DELETE(not deleting)










Attach Code

// ADDING MOVIES

criarBotoesJogos = function(){

var cBotoesJogosX:Number = null;
var cBotoesJogosY:Number = Stage.height/2 - 50;

for (i=1;i<=3;i++){
var novaDepth:Number = this.getNextHighestDepth();
var novoBotaoJogo:MovieClip = this.attachMovie("botaoJogo"+String(i),"botaoJogo"+String(i),novaDepth,oIconesJogos);
novoBotaoJogo._alpha = 0;
novoBotaoJogo._height = 100;
novoBotaoJogo._width = 100;
novoBotaoJogo.enabled = true;
novoBotaoJogo.filters = [inserirShadow];
var aparecerIcone1:Tween = new Tween (novoBotaoJogo, "_alpha", Strong.easeOut, novoBotaoJogo._alpha, 100, 2, true);
novoBotaoJogo._y = cBotoesJogosY;
novoBotaoJogo._x = cBotoesJogosX;
cBotoesJogosX+=160;
}
cBotoesJogosX = Stage.width / 2 - 200;
}

// DELETING THEM

function apagarIconesJogos ():Void {

legendaJogos._alpha = 0;
conteudoCima.conteudoJogoCima.text = "";
conteudoBaixo.conteudoJogoBaixo.text = "";

var apagarIcone1:Tween = new Tween (botaoJogo1, "_alpha", Strong.easeOut, botaoJogo1._alpha, 0, 2, true);
var apagarIcone2:Tween = new Tween (botaoJogo2, "_alpha", Strong.easeOut, botaoJogo2._alpha, 0, 2, true);
var apagarIcone3:Tween = new Tween (botaoJogo3, "_alpha", Strong.easeOut, botaoJogo3._alpha, 0, 2, true);

/*

apagarIcone1.onMotionFinished = function(){
botaoJogo1.unloadMovie();
botaoJogo2.unloadMovie();
botaoJogo3.unloadMovie();
}

}

Attaching Shared Movies
Ok, I've searched everywhere I can think of, and haven't quite figured out the best way to do this... Maybe someone else can give me a hand.

The Challenge:
Find a bandwidth efficient way to attach MCs to my main movie. MUST BE PRELOADABLE!!!

Possible Solutions:
1. Save each MC as a separate SWF and call LoadMovie on it when you need it. CON - Many requests to the server (each page will have at least one request, and on most will require at least 2 and up to 9)

2. Use shared assets to link to these files. CON - Not possible as of a 2001 TechNote from Macromedia, and continued testing still shows the same problem.

3. Set the linkage of each of these, and store them all in my main movie. CON - 1st Frame size becomes HUGE (like 93K so far, and only ~ 1/2 way done)

4. ??? Any other options? I haven't found a suitable approach yet, but maybe I'm missing something. I would greatly appreciate ANYTHING you can do for me

Aaron

Attaching Movies And Setting Its Variables
How can I set variables I have built into a mc, in the same script I use to attach the mc to the main movie. At the moment, it looks to me as if the mc is attached last, and not when you actually code the "attachMovie" function.

Attaching/removing Movies, And Sound.
Hi all,
I have an empty movie on the stage in the _root called ConMovie, this is a container for loading other movies into - quite default menu behaviour, and all works fine except I have a couple of questions, especially with sound.

summary of what is in the _root movie:

FRAME1 is initing everything

FRAME2 stage has only the menu movie (doesnt have ConMovie), and the execution stops here, waiting for you to select something. if you select something it goes to FRAME3

FRAME3 stage has no menu, only ConMovie, and this is where ConMovie.attachMovie(MovieID, "Content", 3333) is called

FRAME4 execution stops, only ConMovie is on stage with the new movie (MovieID) attached to it (there is an Event sound on frame 2 of this movie, so short music is looping), and a back button. If you press back it does ConMovie["Content"].removeMovieClip(); gotoAndStop(2);

my questions are:
1. Do I actually need to do removeMovieClip as when the playhead goes to FRAME2 the ConMovie is no longer on stage, so is presumably destroyed, along with its contents?

2. Do I need to do ConMovie["Content"].unloadMovie(); to free memory or was it destroyed like in my first question.

3. When the playhead comes back to FRAME2 (and the menu is back and ConMovie is gone) the audio wont stop!!! why!!! I've tried doing removemovie and unloadmovie, but the audio is still there!! in fact in FRAME2, ConMovie isnt even on the stage but the audio still loops!!

So in ConMovie I created a sound object which I dont use for anything except if you press back in FRAME4 I do ConMovie.MySound.stop(); as well as the unloadmovie etc...and that worked, audio shuts up (I should bloody well hope so!!)....however what worries me is do I have to do that? why isnt the sound stopped and unloaded from memory when I do removeMovie or attachMovie?

thx if you read this far!!

Memo.

Question On Attaching Movies From A Loaded Swf
Ok, I'm loading in a .swf into _level1. Inside this .swf there is a movieclip with its linkage set to, lets say, 'newMC'. Is it possible to attach said movieclip onto _level0?

Dynamically Attaching Movies (attachMovie)
Hey,

I am trying to biuld a dynamic navigation menu in flash (5) and the menu buttons are based on some PHP I am loading to flash. I can load the content fine. Determine the number of buttons needed. I can even attach one movie kind of successfully. It attaches the first one to the right area, but does not move to new coordinates. So my question is, if you look at my code, can you see if I am doing anything wrong? Or forgetting something? I've been stumped for a while. This is my first time working with attachMovie, so thanks in advance for any help

// CODE
// For this example, _root.section_2_primary_count = 4

var sub_nav_path = _root.sub_nav_main.sub_nav;

if ( _root.section_2_primary_exist != "0" ){

// set initial coordinates
var attachedMovie_x = 6;
var attachedMovie_y = 10;

i = 1;
while( i <= _root.section_2_primary_count ) {

attachedMoviePath = "sub_nav_section_" + i;
sub_nav_path.attachMovie( "nav_point_template", attachedMoviePath, i + 1 );

sub_nav_path.attachedMoviePath.attachedMovie_x = attachedMovie_x;
sub_nav_path.attachedMoviePath._y = attachedMovie_y + 18;


attachedMovie_y = attachedMovie_y + 18;
i++;
}
}

// END CODE


Thanks,

-c

Attaching Movies With Embeded Buttons
Using Flash 8
Action Script 2.0

Hi,

I am pretty new to action script, i'm reading Flash 8 Professional (training from the source) and Flash 8 Action Script (training from the source) to get my head round flash 8/actionscript and to get to a comfortable level to develop/design flash sites.

I've got a question - when loading a button into the stage using attachmovie in actionascript how can the <instance name> for that button which has just been loaded by attachmovie be set in actionscript because, I've got a actions layer which includes all the actionscript which includes a test.onRelease = function. I would like "test" to be assoicated with the button which i have just loaded using attachmovie so events for that button can be controlled. (i.e. when the button is selected the contacts information is loaded)

Does anyone have any ideas on this? Hope i am going down the right line with trying to create a side menu.

Thanks for those reading my post.

Garry

Attaching Movies And Dynamically Calling Them
Right, to say I'm getting a little frustrated with this is an understatement.

Basically, I'm using attachMovie to load in a linked movieclip from the library, I then need to dynamically (depending on which part of the movieclip is clicked) load in another linked movieclip into the mc originally loaded.....if that makes sense.... Loading the first movieclip is working perfectly, but I'm having real trouble loading in the second into the original.


Code:
loadHolder = function(wBag) {
_root.dw_mc.pcb_mc._visible = false;
_global.cBag = wBag;
unloadMovie("holder_mc");
_root.dw_mc.attachMovie(wBag, "holder_mc", 1, {_x: 200, _y: 200});
}

loadFabric = function(selectedBit, fabric) {
var selectedMc:Object = new Object();
selectedMc = _root.dw_mc.holder_mc[selectedBit];
trace (selectedMc);
unloadMovie(selectedMc);
selectedMc.attachMovie(fabric, "fabric_mc", 1, {_x: 0, _y: 0});
}

_root.fb_mc.red_mc.onRelease = function() {
selectedBit = "bottom_mc"; //temp until part selection works
loadFabric(selectedBit, "exf_red");
}
loadHolder is the function that is working, and is called when the frame runs, loadFabric is the one with issues. It unloads the movie perfectly, but refuses to load the linked movieclip (currently just a red square) in.

Hope someone can spot the no doubt stupid mistake I've made, thanks all!

Attaching Movies That Contain Components Problem.
I am trying to attach a movieclip that contains a TextArea component. The problem is that when I attach the movieclip the component displays properly but I dont have access to the properties of it, namely the .text.

I have looked in the debugger and the attached movie shows up but the component is not inside the clip. This is weird because it is clearly visible on the screen inside the attached clip.

Is there something I am missing. I have tried just placing the movieclip on the stage and it shows up in the debugger with the component inside.

Any help would be greatly appreciated.

Attaching Images
Okay, so... I have 323 Images that have been imported into flash. I need to be able to reference to them in flash. As in using the attachMovie() command to be able to attach which ones i need at the time. Do I have to convert them all to movieclips to be able to attach them to the stage? Or is there a command that i can use like with createEmptyMovieClip() and like put it into a movieclip then use that. And if converting them all to movieclips and setting the linkage is the only way to do it is there a fast way to do all 323? Or do i have to do each one seperately? Thanks for your time.

Help Attaching/adding Movies From Library To Scrollpane
Hi,

I'm a newbie with action script and working in Flash MX,...can anyone please point me in the right direction with adding movies from the library to a scrollpane...

I have a scrollPane (scrollPane1) and a movie (movie1). I just(!) want to be able to dynamically add a number of instances of the movie to the scrollpane.

With the following code, 10 instances of movie1 are added to the stage but they do not appear to be attached, or anything to do with the scrollpane, since it does not scroll to accomodate them.

code:
x = 50;
increaseBy=60;
for (i=1;i<=10;i++){
sq = _root.scrollPane1.attachMovie("movie1","mylabel"+i ,i);
sq._x = x;
sq._y = 30;
x=x+increaseBy;

}


Can anyone see what i'm doing wrong? I have litterally spent many hours over a few days looking through the help file and many examples of similar on this site, but I must be missing something somewhere (yes, a brain, i know what you're thinking lol .

many thanks to anyone who can help.

MRB

A Problem Attaching Movies To Stage In A Loop
I am trying to attach a number of movie clips to the stage in a loop and its only placing one instance on the stage. Are they all hidden benieth eachother? How do i fix this?


Code:
RecCount = 3
var xposition:Number = 400;
var yposition:Number = -50;
function loadclips() {
for (i=0; i<RecCount; i++) {
p1.two.attachMovie("casebutton", "casebuttond"+i+"_mc", this.getNextHighestDepth(), {_x:xposition, _y:yposition});
yposition = yposition+20;
}

[F8] Dynamically Attaching Movies, Making Buttons, Etc
I have a file that gets information from an xml then creates a button and sets text for each node. this is what I have so far:

PHP Code:



var aBrochureNames = new Array();
for (var j = 0; j<brochureCount; j++){
    var brochureNames = rootNode.childNodes[1].childNodes[j].attributes.NAME;
    aBrochureNames.push(brochureNames);
    set('_root.title'+ (j+1),aBrochureNames[j]);
    if ((j+1) == brochureCount){populateBrochures();}
}
function populateBrochures(){
    for (var m = 0; m<brochureCount; m++){
        var bCount = m+1;
        var myMovieClip = ['brochure_'+ bCount];
        this.attachMovie(myMovieClip, 'brochure'+ bCount +'_mc',bCount);
        this['brochure'+ bCount +'_mc']._x += 50 + (m*160);
        this['brochure'+ bCount +'_mc']._y = 410;
        var myButtons = ['brochure'+ bCount +'_mc'];
        buttons(myButtons, m);
    }
}
function buttons(btn, m){
    btn.onRelease = function(){
    }
}




the first chunk gets the names from xml and creates variables.
the second chunk places the clips and assigns the names.
but I can't get them to be buttons.. it all works except for the button part.


IMS

AS2 - Attaching Duplicate Movies To One Large Movieclip
I've duplicated a bunch of movieclips with something like:

movie1.movie_to_dup.duplicateMovieClip("dup_name", this.getNextHighestDepth());

Now, what I want to do is put all those duplicates into one container movie.

How is that done?

Attaching Quicktime Movies To A Flash Website
Looking for some help people

I have designed a website in flash and am now trying to attach a quicktime movie to play, and am having a number of problems with this.

Fistly if I embed the movie like flash suggests the sound becomes out of syne. So my next option was to attach it as a progressive download. This works in flash however when I test the site with test movie the movie doesnt appear at all. Its just blank.

Also how can I play a .flv file as when my quicktime movies convert to .flv files I can no longer see them. Why?

Please can someone advice me the best way to attach a quicktime movie. I have been going at this all week.

Tell Frame To Change If A Specific Frame Combination Is Loaded
To get a better idea of what Im talking about please check my flash page. http://www.munktiki.com/Munk-e.htm

You can see that when a different munk-e color is selected and you have his ear extentions on(bottom left in the piercings menu)that the colors dont match.


So.... when the color movie/orange frame is selected and the earring movie/ear extensions frame is selected then the orange frame will tell the earrings movie to go to the correct corrisponding color earring.
Man I hope this makes sense, it barely does to me.

Hope someone can help

Help Load A Movie (and Frame) On A Specific Frame In My Timeline
I need to Load a movie and go to a specific frame within that loaded movie.


I know how to do this "on press & release" commands but how do I get it to load when a certain frame is reached in my timeline.


Example. When finished preloading it plays frame 25. When it gets to frame 25 I wan't a movie to load and start on a certain frame.

If you need more info or I am not making myself clear, please let me know.

Thanks in advance.

[F8] Attaching + Linkage + Images XML?
Hi,

I'm making a Flash Cover Flow web page. What I do is use a for loop to set the linkage with my Mc [i] from the library, but somehow it doesn't get loaded in. I'm not sure if you can use linkage and XML to do this.

When I do get the images loaded in I lose the ability to import my reflection class and my rotation.

Can someone please explain or help me out. It would be greatly appreciated.

This is my XML and my for loop that attaches MovieClip.


Code:
var x:XML = new XML();
x.ignoreWhite = true;

var urls:Array = new Array();
var captions:Array = new Array();
var whoIsOn:Number = 0;

x.onLoad = function(success) {
var number:Array = this.firstChild.childNodes;
for(i=0;i<number.length;i++) {
urls.push(number[i].attributes.url);
captions.push(number[i].attributes.caption);
trace(urls[i]);
trace(captions[i]);
mc = this.createEmptyMovieClip("mc_"+i, i);

}

Download_On_Itunes.caption.text = captions[0];
mc.attachMovie("my_mc"+((i%12)+1),"urls"+([i]+1),1);
whoIsOn = 0;

}

x.load("gallery.xml");

//PRESET---------------------------------------
var home = this;
var refArray:Array = new Array();
var loopArray:Array = new Array();
//INIT-----------------------------------------
for (var i = 0; i<num; i++) {
mc = this.createEmptyMovieClip("mc_"+i, i); // THIS ONE I COMMENT OUT AND NOTHING WORKS

mc.attachMovie("my_mc"+((i%12)+1),"urls"+([i]+1),1);

Download_On_Itunes.author.text = linkArrayTitle[0];// Place text inside Download_On_Itunes.author.text for the first time only

mc.index = i;

//Numbering for debug
var ref:ReflectionFlipper = new ReflectionFlipper(mc, 3, backgroundColor);
refArray.push(ref);

// MC Fuse

if (mc.index<=lastP) {//set MCs position if they are allowed to show up. And Fuse them.
mc._x = this["guideLine"+i]._x;
loopArray.push(mc);

if (mc.index == centerP) {
mc._xscale = mc._yscale=0;
mc.scaleTo(scaleVal,.5,easingType,.5,{startfunc:'calcRotation', startargs:mc});
Download_On_Itunes.swapDepths(this.getNextHighestDepth());
Download_On_Itunes.captions.swapDepths(this.getNextHighestDepth());
} else {
mc.tintTo(backgroundColor,tintVal,0,easingType);
}
} else {
mc.tintTo(backgroundColor,tintVal,0,easingType);
mc._visible = false;

// set invisible MC in deeper Level.
mc.swapDepths(-1*mc.index);
}
//Y MC

mc._y = yLevel;//set all MC's _y position
// MC
//
calcRotation(mc);
mc.onPress = function() {
home.sequenceFlg = true;
sequenceSlide(this);
};
//
//MC in both sides are invisible
if (i<1 || i>=lastP) {
mc._alpha = 0;
mc._visible = 0;
}
}
for (var q = 0; q<num; q++) {

mc.attachBitmap("my_mc"+((q%12)+1),"urls"+([q]+1),1);
}

for (b=1; b<=12; b++) {
this["btn"+b].index = b;
this["btn"+b].onPress = function() {
home.sequenceFlg = true;
if (home["mc_"+(this.index-1)]._alpha == 100) {
sequenceSlide(home["mc_"+(this.index-1)]);
} else {
sequenceSlide(home["mc_"+(this.index+12-1)]);
}
};
}

I've also attached the files. Please Click Here

Loading/attaching Movies Based On Variable Values
I'm looping through elements of an array in order to dynamically load various thumbnails, one by one, onto the stage. The array is populated when the main flash movie queries a server side program with a parameter named 'category' (the value of which is the category name corresponding to a given list of thumbnails) and recieves in return a list of thumbnail filenames which must be loaded into the movie.

I use the same concept to build a navigation menu, except that instead of using the loadMovie() function, I use the attachMovie() function to load menu buttons from the flash movie library (the button text for each menu item is then dynamically set based on data retrieved from the server).

My dilema is that I can dynamically generate this menu without problems, but creating the dynamic table of thumbnails isn't working so good. Have a look at this code:

Now while this method works like a champ...

Code:
// function to dynamically add a movie clip to the stage from the movie library
function add_a_movie (libelement,clipvarname) {
// keep track of the movie clip level heirarchy
_global.DEEPEST_SBLV++;
// attach library element to the movie
_level0.attachMovie(libelement,clipvarname,_global.DEEPEST_SBLV);
// get a reference to the new movie clip
var clippath = eval('_level0.' + clipvarname);
// return a reference to the new thumbnail movie object
return clippath
}
...This method does not work at all

Code:
// function to dynamically load a movie clip from an external source
function load_a_movie (url,clipvarname) {
// keep track of the movie clip level heirarchy
_global.DEEPEST_SBLV++;
// create an empty movie clip into which the loaded image can reside
_level0.createEmptyMovieClip(clipvarname,_global.DEEPEST_SBLV);
// load image into the movie
var clippath = eval('_level0.' + clipvarname);
clippath.loadMovie(url, '_level0.' + clipvarname);
// return a reference to the new thumbnail movie object
return clippath
}
What am I doing wrong?

Problem Attaching Movies (switches Places When Reloading)
--------------------------------------------------------------------------------

Hi,

i have the following code to build a dynamic menu within a section of a mini-site, attaching the number of buttons movie clips required:


code:
_global.totalPersonajes = 8;
nuevoItem = new Object();
MovieClip.prototype.poblarSubmenu = function() {
for (i=1; i<=totalPersonajes; i++) {
this.attachMovie("moldePersonajes", "sub"+i, i, nuevoItem);
nuevoItem._x =(37*i);

}
};




this function is attached to a movie clip on load.

It works fine, but, when i change section (wich unloads the movie clip in subject) and then come back, the first item is always put at the end of the row of buttons, leaving the first spot empty. Is the most unusual thing, and i guess i cuoldn't do it if i wanted to. When the movie returns to frame one it works fine, but past that frame, it yields that error. I've tried reseting all concerning variables with no luck, tried sending the header to a blank frame a thousand miles away and then come back for the next section, and nothing... i'm running out of ideas...

to see what i'm talking about, here 's the thing i'm working on... if you go to "personajes", you'll see Bruce Wayne as the first item of the top menu... then go to "descargas", then head back to "personajes" and now Bruce is the last button and there's nothing where it was.

Thanks in advance


Sir Patroclo

[CS3] Actionscript 2.0 -- Attaching Duplicate Movies To One Large Holder
I've duplicated a bunch of movieclips with something like:

movie1.movie_to_dup.duplicateMovieClip("dup_name", this.getNextHighestDepth());

Now, what I want to do is put all those duplicates into one container movie.

How is that done?

Problem With Attaching Multiple Movies In Movie Clips
Hi there,

I am trying to get this code to work for my MA project... I am trying to get multiple sounds playing when a movie clip called "WalkerMC" gets near them. the sound fades in/out depending how far the Walker is from the sound object. You need to use up and down arrows to move the walker and left and right to turn him around.

I have created emtpy movie clips for each sound...

I am using the following code to play the 2 sounds (code below) - and I have also attached the fla (flash8). where am I going wrong?

Any help very much appreciated!

Thanks

gayeta


ActionScript Code:
//
//
MovieClip.prototype.CalculateSounds = function() {
    this.createEmptyMovieClip("bandStandMC", this.getNextHighestDepth());
    this.bandSound = new Sound(bandStandMC);
    this.bandSound.attachSound("euphoria");
    this.bandSound.setVolume(0);
    this.bandSound.start(0, 999);
    this.onEnterFrame = function() {
        //Work out the volume and panning of each sound
        //Band sound
        //Band is positioned at co-ordinates 357, 288
        var xDistanceToBand = this._x - 357;
        var yDistanceToBand = this._y - 288;
        var distanceToBand = Math.sqrt((xDistanceToBand * xDistanceToBand) + (yDistanceToBand * yDistanceToBand));
        var angleToBandRadians = Math.acos(xDistanceToBand / distanceToBand);
        var angleToBandDegrees = -1 * ((angleToBandRadians * 180) / Math.PI);
        if (this._y > 288) {
            angleToBandDegrees = -1 * angleToBandDegrees;
        }
        var panValue = Math.sin((((this._rotation - angleToBandDegrees) * Math.PI) / 180));
        if (distanceToBand > 100) {
            this.bandSound.setVolume(0);
        } else {
            this.bandSound.setVolume((100 - distanceToBand) / 2);
            this.bandSound.setPan(100 * panValue);
            bandStand_show.gotoAndPlay(2);
        }
    };
};
WalkerMC.CalculateSounds();
//sport pitch sound 1
MovieClip.prototype.CalculateSounds2 = function() {
    this.createEmptyMovieClip("sportPitch1", this.getNextHighestDepth());
    this.sportSound = new Sound(sportPitch1);
    this.sportSound.attachSound("cricket");
    this.sportSound.setVolume(0);
    this.sportSound._width = 140;
    this.sportSound._height = 100;
    this.sportSound.start(0, 999);
    this.onEnterFrame = function() {
        //Work out the volume and panning of each sound
        //Band sound
        //Band is positioned at co-ordinates 203, 288
        var xDistanceToSport = this._x - 274;
        var yDistanceToSport = this._y - 350;
        var distanceToSport = Math.sqrt((xDistanceToSport * xDistanceToSport) + (yDistanceToSport * yDistanceToSport));
        var angleToSportRadians = Math.acos(xDistanceToSport / distanceToSport);
        var angleToSportDegrees = -1 * ((angleToSportRadians * 180) / Math.PI);
        if (this._y > 320) {
            angleToBandDegrees = -1 * angleToBandDegrees;
        }
        var panValue = Math.sin((((this._rotation - angleToSportDegrees) * Math.PI) / 180));
        if (distanceToSport > 100) {
            this.sportSound.setVolume(0);
            sportPitch1_show.gotoAndPlay(1);
            //trace(angleToBandDegrees);
            //trace(panValue);
        } else {
            this.sportSound.setVolume((100 - distanceToSport) / 2);
            this.sportSound.setPan(100 * panValue);
            sportPitch1_show.gotoAndPlay(10);
        }
    };
};
WalkerMC.CalculateSounds2();
//
//

Using LoadMovie Problem With New TextField.StyleSheet() When Attaching 2 Movies
Hi everyone I'm new to this forum, I need some help here is the senario.

I have 2 movies
contentcomponent.fla - let's call this movieB
and
ecs_markets.fla. - movieA


In movieA I use this script to pull movieB

loadMovie("contentcomponent.swf",mainstage);

In movieB pretty much calls a an xml which depending on an ID it displays certain text.

Here is current problem, i have a couple =)

In movieA I have this code:

var format = new TextField.StyleSheet();
var path = "presentation.css";
dummyText.htmlText = Level5contentDataformat.load(path);
trace(path)
format.onLoad = function(loaded) {
trace(loaded)
if (loaded) {
mainContainerRef.copy.styleSheet = format;
mainContainerRef.copy.text = dummyText.text;
} else {
mainContainerRef.copy.text = "Error loading CSS file!";
}
};



I narrowed the problem down to the trace(loaded),
for some reason this variable is undefined when MovieA pulls MovieB but when I run this by itself. Meaning I run MovieB that variable is True.

So that leads me to believe it has something to do with loading movie.

can anyone please help.



Also I have question about using _global.variables, i'll post another thread.

Thanks
Carlos

Nested Loops, Attaching Movies And Load Order
i'm attaching mc's using a nested loop. The mc's which are being attached reference each others position, so that once one mc is attached it looks up the chain to see where the mc attached previously is and moves accordingly. (The master mc is created in the outside loop below.)

When using nested loops like this when is each mc actually put on stage?

i suspect it is a load order thing, because the nested loop mc's do not seem to recognise the master mc when attached this way, although if i place the mc's created in the outside loop onto the stage in the authoring envir. the nested loop works fine.

this is a bit difficult to explain. but if you have understood this and can lend some assistance it'd be cool.

cheers


//---
gSections = ["Hotels", "Reception", "Wedding Party"];
_global.gDepths = 0;

for (var j = 0; j<gSections.length; j++) {
//attach 'leader' mc
_root.attachMovie("heart", _root.gSections[j], gDepths);
_root[gSections[j]]._x = Stage.width/2;
_root[gSections[j]]._y = Stage.height;
gDepths++;
for (var i = 0; i<gSections[j].length; i++) {
//attach 'trails'
tempTrailName = gSections[j]+"_";
_root.attachMovie("trail", tempTrailName+(i+1), gDepths);
currLetter = gSections[j].substr(i, 1);
_root[tempTrailName+(i+1)]._x = _root[tempTrailName+i]._x;
_root[tempTrailName+(i+1)]._y = _root[tempTrailName+i]._y;
_root[tempTrailName+(i+1)].letter.text = currLetter;
gDepths++;
}
}

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