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




Attach Mc With For Loop



im trying to create multiple points across my movie clip

I want to do somethign like this


Code:
var ["point"+i]:Point = new Point(i);
addChild(["point"+i]);



FlashKit > Flash Help > Actionscript 3.0
Posted on: 12-23-2007, 05:24 PM


View Complete Forum Thread with Replies

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

Attach Functions To Mc's From Within Loop?
Hi guys,
Basically I have 10 mc's on the stage called button1 to button10 and I am trying to attach the 3 below functions to them.
Can anyone tell me where I'm going wrong?

Many thanks

for(var i=1; i <= 10 ;i++){
buttonVar = "button"+i
buttonVar.onRollOver = RollOverFunction;
buttonVar.onRollOut = RollOutFunction;
buttonVar.onRelease = ClickFunction;
trace (buttonVar)
}

Attach Sound Using AS 2.0 And Have It Loop.
I am creating a sound player for a website and cannot get the sound to repeat. I downloaded the sound from flashkit.com and it is a 7 second loop. When i use a MC, i am able to loop the sound with no problem, however, using the attach sound method, it plays once and then stops. Do i need to use an onEnterFrame event to keep it going? Any assistance is appreciated. The code i am using to attach the sound is below.







Attach Code

this.createEmptyMovieClip("mcSoundHolder", this.getNextHighestDepth());
var sndAudio:Sound = new Sound(mcSoundHolder);
sndAudio.attachSound("sound1");
sndAudio.start();

How Can I Dynamically Attach Movies In A Loop? Help
hi, im getting a bit stuck with trying to attach movieclips according to a randomized array (for a card game)
all it seems to do is writeover every card with the next one so all im left with is the last card of the hand being shown
below is my code:


tempx = 210;
tempy = 315;
for (i = 0; i <13; i ++){
trace((hand1[0][i][0]*10)+(hand1[0][i][1]));
j = new String(i);
//the element in the array give the linkage number
//i have tried to assign a variable j that increments every time
// so that can be the reference name on stage
//have tried to assign i to be the layyer
this. attachMovie((hand1[0][i][0]*10)+(hand1[0][i][1]),j
, i);
this._x = tempx;
this._y = tempy;
//so is positioned right slightly every time
tempx = tempx +10;
}


any help would be very much appreciated!

thanks

chimpo

Attach Unique MovieClip From A For Loop
Hello, I am trying to attach different movieClips at runtime all within a for loop. I am running into trouble with the movie not getting attached. But, if I change the movie name that needs to attached to something solid like: "trail1" it works fine ..as apposed to: "trail"+i

Any thoughts out there?

Here the code so far:

function checkState(ID) {
if (ID.clicked == false) {
ID.gotoAndStop(2);
} else if (ID.clicked == true) {
ID.gotoAndStop(1);
}
}
for (i=1; i<11; i++) {
var trailName:String = "trail"+i;
_root['trail'+i].onPress = function() {
_root.attachMovie(trailName, "trail", 1, {_x:214, _y:136});
checkState(this);
};

}

Attach Duplicate A Movie In A Loop
want to make a raindrop effect, i can attach and 1 movieclip dynamically to the stage,
but i am unsure how to make a lots of duplicates of the raindrops in a loop

blue_box.onEnterFrame = function(){

blue_box.attachMovie("red_box", "newname1", 1);
}


this is the part im unsure about!!

blue_box.onEnterFrame = function(){
var:Number i = 0;i < 100; duplicateMovieClip"rainDrop
blue_box.attachMovie("rainDrop", "newname1", 1);
}

Attach OnRelease To Multiple Buttons With For Loop
i have 40 mc's on stage that are used like buttons, with rollovers etc.. I want to dynamically attach a sound effect onRelease to all 40 mc's using a for loop, i have this actionscript but the trace is not working:

code:
for (var i = 1; i<=40; i++) {
trace("button"+i);
("button"+i).onRelease= function() {
trace("yes"+i);
};
}

Attach OnRelease To Multiple Buttons With For Loop
i have 40 mc's on stage that are used like buttons, with rollovers etc.. I want to dynamically attach a sound effect onRelease to all 40 mc's using a for loop, i have this actionscript but the trace is not working:


ActionScript Code:
for (var i = 1; i<=40; i++) {
    trace("button"+i);
    ("button"+i).onRelease= function() {
        trace("yes"+i);
    };
}

Loop Through Dynamic Clips, Attach Rollover
I'm trying to apply a rollOver function to 15 movie clip slides without having to manually write a script for each one. I thought I would be able to do this with a simple for loop, and dynamically calling the instance, but no luck. Any thoughts? Many thanks to anyone who can illuminate a solution.

for (i=1;i<=15;i++) {
this["slide" + i].grip_rt.onRollOver = function() { this["slide" +i].rotate_arrow_tr.gotoAndStop(2); }
}

Attach Mc Or Sound Loop Causing Preloader Problems
Is that true that if you attach a big sound loop or mc (like 200k), it will cause your preloader working not properly?

Setting Attach Movie Params Inside A Loop
Last edited by Holaso : 2003-11-16 at 23:00.
























can someone tell me what's wrong with this?? here's my AS :

ActionScript Code:
d = 100;
for (j=0; j<3; j++) {
// some things happen in here, not important
for (i=0; i<3; i++) {
_root.attachMovie("cc_trigger", "card_trigger"+i, d, {_xgX+j*spread, _ygY-(cardSize*i), textbox:cardText[i], Id:j});
d++;
trace (j);
}
}

I've got two loops which attach clips to the stage in a 3 x 3 matrix.

the problem is "Id:j" in the second "for" loop. it's should set the variable "Id" in the 3 clips in the first row to "0", the 3 clips in the second row to "1" and the 3 in the third row to "2".

Instead it sets all the Id's in all clips to 2 (??) (ie it seems to be waiting til all the loops are finished and then looking at what "j" ends up as, which is 2).

You'll see in the output window when you trace "j" it goes
0
0
0
1
1
1
2
2
2

which is what it should do. help?

Nick Fracture

Setting Attach Movie Params Inside A Loop
can someone tell me what's wrong with this?? here's my AS :

d = 100;
for (j=0; j<3; j++) {
// some things happen in here, not important
for (i=0; i<3; i++) {
_root.attachMovie("cc_trigger", "card_trigger"+i, d, {_xgX+j*spread, _ygY-(cardSize*i), textbox:cardText[i], Id:j});
d++;
trace (j);
}
}

I've got two loops which attach clips to the stage in a 3 x 3 matrix.

the problem is "Id:j" in the second "for" loop. it's should set the variable "Id" in the 3 clips in the first row to "0", the 3 clips in the second row to "1" and the 3 in the third row to "2".

Instead it sets all the Id's in all clips to 2 (??) (ie it seems to be waiting til all the loops are finished and then looking at what "j" ends up as, which is 2).

You'll see in the output window when you trace "j" it goes
0
0
0
1
1
1
2
2
2

which is what it should do. help?

Nick Fracture

Detect A-Attach B-Release B-Attach To C ?
Ok here's something that sounds simple.

I have mc A moving slowly across the screen.
I would like to detect it's position x and y, and then at a certain coordinate(let's say x= 200 and y=300) attach mc B(which is just floating around) to attach itself to and follow mc A movement.
And then at some point attach mc B to attach itself to another mc(C).

Is it also possible to attach mc B to a certain pixel (xy) on mc A (or C).

Any ideas

Cheers

Trinitee

Attach, Remove And Re-attach MC's
I've been trying to make three movieclips animate accross the stage. They fade in, move accross and fade out.

I've got it currently set up so that they are attached at runtime - fade in / animate / fade out and are removed. The problem i'm having is getting them to re-attach properly. I can't seem to get the re-attachment loop working correctly.... here's the code as far as i have it:


ActionScript Code:
_global.k = 0;
//max amount ofo clouds allowed on the stage
var cloudsV = 3;
 
    //create an empty clip to house all the clouds
    this.createEmptyMovieClip("CLOUDcontainer", this.getNextHighestDepth());
    //add the clouds
    addCLOUDS()
   
 
    function addCLOUDS(){
 
        do {
            //attaches the clouds from the library
            //possitions them [randomly on the y - within a range]
            //and set the speed randomly
            CLOUDcontainer.attachMovie("cloud", "cloud"+k, k+20)
            CLOUDcontainer["cloud"+k]._x = 900//randRange(50, 900)
            CLOUDcontainer["cloud"+k]._y = randRange(182, 400)
            CLOUDcontainer["cloud"+k].movementV = Math.random(5)+1
           
            k++;
          
        } while (k != cloudsV);
 
       
    }
   
_global.fadeOUT = function(me) {
   
    if(me._alpha>5){
    //simple fade out func
    me._alpha = me._alpha + ((1 - me._alpha)/10);
   
   
     }else {
 
        //removes the cloud after its been faded out
        removeMovieClip(me);
        //deducts one from the amount of clouds on the stage
        --k
        //calls the func to re-attch the clouds
        addCLOUDS()
        
     }
   
}
 
//random number within a range generator//
function randRange(min:Number, max:Number):Number {
    var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
    return randomNum;
}
//
 



this is on the cloud MC frame 1


ActionScript Code:
this._alpha = 0;
 
this.onEnterFrame = function(){
   
    if(this._alpha<90){
    
    
     this._alpha = this._alpha + ((this._alpha+2)/3);
   
 }
 
    if(this._x>20){
       
        this._x = this._x - (this.movementV);
       
    }
   
    if(this._x<150){
       
        this.gotoAndStop("fadeOUT");
       
    }
 
}
 
stop();


this is on the cloud MC frame "fadeOUT"


ActionScript Code:
this.onEnterFrame = function (){
   
 fadeOUT (this)
 trace(" this = "+this)
 
}



I think its a fairly simple problem - but if anyone can help please let me know, it would be a big help [even if you can suggest a better way of doing this ]

Attach Clips From Xml, Reload Xml Attach Clips Again
i'm trying to figure out how to reset or refresh clips that are dynamically attached to another clip based on records returned through xml.

basically if the user chooses a different filter for the database query I need to be able to refresh a scrolling list made up of clips which will be different based on the filter.

this is what I have for a function. I try to use "attachEmptyMovieClip" but to no avail. any help would be great!


Code:
getAll=function(){


members = getMembers.firstChild.childNodes;

for (var i=0; i<members.length; i++) {
holder.createEmptyMovieClip("new_mc", 10);
item = holder.new_mc.attachMovie("listClip", "listClip" + i, i);
item._y = 23*i;
item.index = i;
trace(item.index);


item.memberName = members[i].attributes.last+", "+members[i].attributes.first;
item.first= members[i].attributes.first;
item.last= members[i].attributes.last;
item.listButton.tabEnabled=false;
item.listButton.onRelease=function(){
_root.triggeredClick="detail";
_root.selectedFirst= members[this._parent.index].attributes.first;
_root.selectedLast= members[this._parent.index].attributes.last;
_root.getDetails();
_root.firstLoad=false;






}
}

}

Any Way Around The Loop Error (loading 8000 Vars, Flash Thinks Its A Loop.)
I have 8000 vars to load....... all at once, so Flash thinks its in a loop at the 3000 mark and gives an error. Is there any way around this?

How Do I Define The Greatest _x Position Based On A Loop, Assuming I Know The Last Element Of The Loop?
Hello,

This may be complicated,

I've a loop that creates emptyMovieClips
then I use one function to onRollOver _xscale them += 10

Now I want to move another movieClip based on the greatest _x position of my previously _xscaled elements, how do I do that?

example

for (var i = 0; i<my_array.length; i++) {
_root.menu_.createEmptyMovieClip("btn"+i, i+1);
}
//
_root.menu_["btn"+i].onRollOver = function() {
this._xscale += 10;
//
MY_DRAGER._x = HIGHT._x;
}

Can this be done?

Thanks,

I Would Like My Sound Loop To Continously Loop Without Looping Over Itself When I Repeat My Images.
I have a sound loop moving along with my flash images. When the flash images finish and I send it back to frame 1, my sound doubles. How can I play my sound loop once, but allow my images to continously loop.

Is there away to just run one loop of sound, and let the image aspect continue to loop.

I would like my sound loop to continously loop without looping over itself when I repeat my images.

Make One Element Loop Without Making Enitre Movie Loop?
i'm trying to make one element continue looping without making the entire movie loop... here's what i mean..

i have a layer that i've name actions which i've asigned a stop(); to at the end of the animation. but i want the red pulsating dot to continue looping/ animating ... to give you an even better idea, here's the swf file...

http://www.push1.com/roster_art_gal.swf

cheers!

LoadVars In A For Loop Not Executing .load Function Until For Loop Completed?
Ok so I have a simply for loop: ID[i] is a global array



Code:


for (i=0;i<12;i++)
{
var loadInfo:LoadVars = new LoadVars();
loadInfo.onLoad=function(success:Boolean)
{
if (success)
{
trace("whatever:"+loadInfo.myname);
}
else
{
trace("Nope");
}
loadInfo.load(ID[i]+".txt");
}



the problem I'm having is that the function doesn't execute until the for loop completes and then it executes 12 times in a row. Output is 'whatever: undefined' 11 times and then 'whatever: Bobble' (which corresponeds to the last .myname value as it should). Why is this? And how can I fix it? To be continued...

~NH

Loop Inside Loop... Why Doesn't Work Properly?
In order to cause a delay, I have put a loop inside another loop. Here it is:

for (a=1; a<6; a++) {
for (b=1; b<10000; b++) {
}
}

Flash delays to show the page but in the end I just see both variables with the maximun value. The point was to see variable "a" growing with delay. What have I done wrong?

Thank you

Function Inside For Loop; How To Give It Parameters Of The Loop
Hey!

This is the code:


Code:

for (i=0; i<5; i++) {
_root.createEmptyMovieClip("temp"+i, 1+i);


_root["temp"+i].beginFill(0xFF0000, 20 + (20*i));
_root["temp"+i].moveTo(0+(60*i), 0+(67*i));
_root["temp"+i].lineTo(100+(60*i), 0+(61*i));
_root["temp"+i].lineTo(100+(64*i), 100+(65*i));
_root["temp"+i].lineTo(0+(55*i), 100+(80*i));

_root["temp"+i].endFill();

_root["temp"+i].onRelease = function() {

trace("button Number = " +i);
}
}


So I made butttons and assigned each one an onRelease function. But each one needs to have assigned a variabile by the value "i" in the for loop.
When I write it like this the function itself is defined only after I click it and it ofcourse asigns all the buttons the same "i", the last value of "i" in the for loop.

How do I do it so I get first button with variable 1, second with 2,... ?

Thx.

Pausing Execution Of Code In A For Loop Between Each Loop. Howto?
I have a for loop which runs x amount of times and between each loop i'd like to implement a small pause of execution of the code. How would i do that? Can something like that only be done using a timer? If so how would i go about doing that and what things should i import? (Trying to do this in a class) ...

Loop Help: XML Attribute Doesnt Stay On Each Object Of The Loop
Hi, i'm working on a gallery that loads thumbnails from an xml file into 3 columns and when you click on a thumbnail it opens a new window with the fullsized image in.

I have modified code from a gallery tutorial to load the thumbnails from a xml file. They are going in 3 columns at the moment (I don't understand why but they are) but only the last image has a hand cursor when you rollover it, and then when you click on it, it traces "undefined" into the output box.

I have put
Code:
trace(images_arr[i].attributes.fullsize);
just below the bit where it loads the thumbnails and it traces the right path from the xml file for each image.

Can someone help me get it to trace the right path from the xml file when you click on ALL the thumbnails, not just the last one.

Thank you so much in advance!



Code:
function GenerateThumbs() {
images_arr = images_xml.firstChild.childNodes;
gap = 10;
this.createEmptyMovieClip("thumb_mc",100000);
thumb_mc._y = 10;
thumb_mc._x = 10;
for (var i = 0; i<images_arr.length; i++) {
trace('generating thumbs'+i);
this.thumb_mc.createEmptyMovieClip("thumb"+i+"_mc", i);
this.thumb_mc.createEmptyMovieClip("thumb"+i+"_tmp_mc", 300);
this.thumb_mc["thumb"+i+"_mc"]._x = ((i%3)*(67+gap));
this.thumb_mc["thumb"+i+"_mc"]._y = Math.floor(i/3)*(67+gap);
this.thumb_mc["thumb"+i+"_mc"].loadMovie(images_arr[i].attributes.thumb);
this.thumb_mc["thumb"+i+"_tmp_mc"].no = i;
this.thumb_mc["thumb"+i+"_tmp_mc"].onEnterFrame = function() {
var _mc = this._parent["thumb"+this.no+"_mc"];
var l = _mc.getBytesLoaded();
var t = _mc.getBytesTotal();
if ((l>=t) && (t>1) && (_mc._width>1)) {
_mc.onRelease = function() {
trace(images_arr[i].attributes.fullsize);
};
}
};
}
}


var images_xml = new XML();
images_xml.ignoreWhite = true;
images_xml.onLoad = function(success) {
if (success) {
GenerateThumbs();
} else {
trace("Error loading XML file");
}
};
images_xml.load("gallery.xml");

Pausing Execution Of Code In A For Loop Between Each Loop. Howto?
I have a for loop which runs x amount of times and between each loop i'd like to implement a small pause of execution of the code. How would i do that? Can something like that only be done using a timer? If so how would i go about doing that and what things should i import? (Trying to do this in a class)
Though i'm wondering if there's an easier way than timers to be able to do something like that, like C's sleep() function for example.

My Sound Loop Is Repeating Itself Ontop Of Previous Loop
Here is a link to a movie that I am working on:


LINK-
http://blue-title.com/v2/


My client says that when you first start the movie, the loop starts fine but when he clicks on one of the three buttons at the bottom (Home, Florida, Alabama) the initial first loop continues to play and a new loop is beginning to repeat while the first one is still playing.

It works fine for me in Firefox and Safari on a Mac.

Any solutions?

Todd Temple

Movie Clips In For Loop Onlydisplaying In 1st Loop
Hi there! I'm new at this so excuse if I'm being stupid.

I'm creating a game which I'm looping through an array and inside the loop I'm playing clips. The clips display only the first time the loop is being run. Here is the actionscript. PLEASE SOMEONE HELP ME... I'M DESPERATE!!!

code:
on (release) {
var myClips = new Array("Fletter", "Lletter", "Aletter", "Mletter", "Eletter");
var myClipsNewName = new Array("mov2", "mov3", "mov4", "mov5", "mov6");
var myClipsValue = new Array (10, 11, 12, 13, 14);
var cnt = 0;
for (var t = 0; t<4; t++) {
for (var i = 0; i if (cnt == -1) {
cnt = 0;
}
var temp = myClips[cnt];
attachMovie(myClips[cnt],myClipsNewName[cnt], myClipsValue[cnt]);
updateAfterEvent();
trace(myClips[cnt]);
if (i == Total-1) {
myClips.splice(cnt, 1);
myClipsNewName.splice(cnt,1);
myClipsValue.splice(cnt,1);
if (cnt == myClips.length) {
cnt = 0;
}
break;
}
cnt = cnt+1;
if (cnt == myClips.length) {
cnt = 0;
}

}
}
}


edit: jbum added as tags

Mp3 Sound Loop Bad. Wav Loop Good.
I have a soundloop which is a WAV file
and it works just fine when i loop it in flash

But when i convert it to an MP3 file...for osme weird reason theres a little less than 1 second pause when it starts again...you can tell its a loop...not smooth

But in WAV format its fine.
Its weird..ive used two different softwares to convert my wav file.
ive used Creative Wave Studio, Ive used a dedicated third party MP3-WAV convertor.

same results...the mp3 has bad looping.

any ideas?

[MX04] Loop Loop Whoops
Hi,

I know this might be really simple but I'm having a problem with my movie continuing to loop even though I've put the stop() function anywhere and everywhere I can think of. Basically, I have some mc's in Frame 1 which perform some calculations in AS. At the end of one of the calculations, I have _root.gotoAndStop(2) (which I'm assuming is telling the playhead to move on to the next frame in the main timeline).

I've put in key frames in the second frame for the same mc's to perform some different calculations which are dependent on variables from Frame 1's calculations. After running through the calculations, the movie won't stop looping and I can't figure out why.

Can anyone suggest a course of action? Thanks in advance.

Stop Loop And Replay Loop
Okay on my stage I have a start(MC) and a stop(MC) and a clear(MC) these will be used as buttons. I also have a dynamic text box that shows my output.

I am making it so when you click start it will start counting from 0 to whenever you hit the stop button, I have changed my fps to 1 so it doesn't crash my computer, And this is where I am running into trouble. Here is my code.

var myTimer = 0;

startBtn.onPress = function() {
this.onEnterFrame = function() {
myTimer = myTimer + 1;
//trace(myTimer);
this._parent.myTxt.text = myTimer;
}

}


stopBtn.onPress = function() {
trace(myTimer);
this.myTimer.onEnterFrame = stop();
}


I would also like it so when you hit start again it picks up where it left off.

Please any help would be greatly appreciated.

Thanks
T

Loop Within A Loop (creating 2 Columns)
Hello. I have the following loop, which works just fine:

ActionScript Code:
yGutter = 30;
xGutter = 28;
numPerRow = 1;
for (t = 0; t < vars.countEmployees; t++)
{
    thumbCont.duplicateMovieClip("thumbCont" + t, 2000 + t);
    this["thumbCont" + t]._y = thumbCont._y + yGutter * Math.floor(t / numPerRow);
    this["thumbCont" + t]._x = thumbCont._x + xGutter * t - xGutter * numPerRow * Math.floor(t / numPerRow);
    this["thumbCont" + t].tID = t;
    this["thumbCont" + t].gotoAndStop(2);
    mainCont.duplicateMovieClip("mainCont" + t, 3000 + t);
} // end of for

you can see this here:http://www.metapps.com/testing/index_email.html

I need to make 2 more columns, same as the first, with the rest of the info from the php file. Right now I have a "LIMIT 0,10" on the MYSQL request so there are only 10 rows. Ultimately there will be three rows with 30 employees.

How would I write this loop?

thanks

XML Nested Loop - Access The Loop Later... But How?
Hello all. I need help desperately, I'm very novice with this kinda stuff. Basically, I have data organized by date in an XML file. I'm trying to make a website application that will allow the user to click on a date (in a text field) to see another textfield populate with all the data under that particular date.

So far, all the information loads into the textboxes at the same time. How can I get it to only load information under a particular date when somebody clicks on that date?

Before I started this project, I was convinced I could do this by manipulating the [j] (see code below) in the myFunc2 function. Currently, it's set up to increment blank_mc._y by whatever value is returned by [j]. But for some reason this doesn't work. I feel that if I could atleas get this part to work - I could probably do the rest.

Any help is greatly appreciated. PS - I'm not sure I even need a nested loop for this...

AS code:

Code:
function loadXML(loaded) {
if (loaded) {
var nodes = this.firstChild;
for (j=0; j<nodes.childNodes.length; j++) {
groups = nodes.childNodes[j];
var info = groups.childNodes;

for (i=0; i<info.length; i++) {
var word2 = groups.childNodes[i].childNodes[0].firstChild.nodeValue;
var url2 = groups.childNodes[i].childNodes[1].firstChild.nodeValue;

_root.myText.htmlText +="<A HREF="asfunction:MyFunc,"+url2+" ">"+word2+"
</A>";
}

_root.myGroup.htmlText +="<A HREF="asfunction:MyFunc2,"+[j]+" ">"+groups.attributes.title+"
</A>";

}
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("links.xml");

function MyFunc2 (blarg) {
//trace (blarg);
//trace (blank_mc._y);
blank_mc._y = blarg;
}

function MyFunc (arg) {
loadMovie(arg, holder_mc);
};

XML Code:

Code:
<?xml version="1.0" ?>
<products>
<group1 title="January">
<item>
<one>foo</one>
<two>foo.swf</two>
</item>
<item>
<one>beans</one>
<two>beans.swf</two>
</item>
<item>
<one>spiders</one>
<two>spiders.swf</two>
</item>
</group1>
<group2 title="February">
<item>
<one>foo2</one>
<two>foo2.swf</two>
</item>
<item>
<one>beans2</one>
<two>beans2.swf</two>
</item>
<item>
<one>spiders2</one>
<two>spiders2.swf</two>
</item>
</group2>
</products>

How Can I Attach A Mc To Another Mc?
hey there - i have stupid problem with actionsscript:

actually i have a site where lots of mcs are to attach,
therefore i wrote a mc attachscript like this:

function attach_mc(mc,mctoattach,deepness) {
_root[mctoattach].attachMovie(mc,mc,deepness);
}

so the problem is, it just doesnt work

sometimes i attach an mc:

attach_mc("mc1","",1);

but want attach to it another mc DYNAMICALLY:

atach_mc("mc2","mc1",1);

you get the point?

how should a dynamic _root.attachMovie statement look like
so it works? any ideas or comments?

Attach A PDF?
I have a new web-site that i made completely in flash mx and i have a page for my resume.. i want to put the pdf icon of my resume on my page so that someone can click on it and it will download for them and open up in acrobat reader on their desktop.. How do i make it so that i can place my pdf file on my flash page? Please help me!

Attach A PDF?
I created a site in flash mx and i want to have a page that people can go into and click on a pdf icon and directly download my pdf file to their computer. I don't know how to get it so on my page all you see is the pdf icon.. how do i get the pdf icon onto my page for someone to download.. please help me!

Attach MC
Hey all,

I wanna ask, if it's possible to make that with the action attachmovie all the movie clips don't show up all at once, but each by each from up to down. Thanks for any idea.

Can't Attach
please help!

I can't even seem to attach this file in order to get help!!
I've tried attaching the following types of files (with the designated extensions and their file sizes) and none of them seem to work. I'm not sure how else to save and attach a file in order to get help from the bulletin board... I've tried:
Flash document .fla 20,647 kb
Flash movie .swf 938 kb
Compressed (zipped) folder .zip 939 kb
Is a swi the same thing as a swf? How do I get flash to save in that format? I don't see how attaching a .gif, .jpeg, or .bmp would help see a movie I'm making in flash. Does saving it in those formats work?

Please advise!!

THANK YOU!

Attach MC
Does anyone know how to attach a MC in AS3?
Thanks!

Attach This
Oh man!! This is seemingly basic stuff, but I just can't get it to work. I have a symbol called "Blue Square". which is a movie clip. I have an instance called "Blue". I want to create a second instance at a different x,y location on the stage. So, I try the code below, but nothing appears where Blue2 should be. What am I doing wrong?

G

myPreloadery("x4.jpg",600,20);


function myPreloadery(myMovie,xpos,ypos){

//delete this.Blue2
//this.createEmptyMovieClip("myHolder", 200)
//Blue2.loadMovie(myMovie);
_root.attachMovie("Blue Square","Blue2",200);

Blue2._x=xpos;
Blue2._y=ypos;

Blue2.loadMovie(myMovie);

_root.onEnterFrame = function() {

var myLoadedBytes = Blue2.getBytesLoaded();
var myTotalBytes = Blue2.getBytesTotal()

var myPercent = Math.floor((myLoadedBytes/myTotalBytes)*100);

if (myPercent == 100) {

delete _root.onEnterFrame
trace("Image 100% loaded!!")
trace(Blue2._height)

}
}


};

How To Attach Pdf?
Hi all,

Just wondering if anyone knows how to create a button action that will open a pdf file in a separate window?

Thanks!

How Do I Attach MCs Only Once?
I want to load animated movie clips with a toggle key (a blinking light that indicates something is turned on). Instead, it loads the first frame of the animated clip and when the toggle is shut off, it removes it. I've also tried the gotoAndplay method, and both produce the same "on/off" problem, so I figured I would have more luck with the attach MC.

is there a way to tell the program to detect for that attached movie clip, and if it exists, do not load another one/ or prevent that one from playing?

Attach 2 MCs
How do I attach 2 MCs to each other?

I don't think I want aatachMovieClip because that seems to:

add an instance of the symbol programmatically. The attachMovie() method adds a new instance of the specified symbol as a nested movie clip of the object from which the method is called.

I want to say if MC_A bumps into MC_B, then MC_A should attach itself to MC_B and follow it wherever it goes.

For my fishing game, I've tried just saying when there is a hitTest the second one's _y and _x equal the first one's, but I have some boolean vars that cause probs. The bools say if there is a hitTest, no other MC should have a hitTest.

Is there some special function for this?

Attach MC
Im having some problem attaching a movieclip on stage.
Im having a MovieClip that is laying on stage, and in this movieClip there is 3 other movieClip.
And each movieClip containing a button.
My problem is attaching a movieClip from library on stage when pressing a button.
i do have a movieClip as a container on stage, but nothing happen.
I guess it have something to do with my buttons being inside of a movieClip that is inside of a n other clip?

XML And Attach
Hey all Scripters,

this is the first of some questions i will have to post in the future, due to my lacking programming knowledge.
okay, here we go:

I have a XML picture loader which got the following code

ActionScript Code:
function loadXML(loaded) {
    if (loaded) {
        xmlNode = this.firstChild;
        image = [];
        description = [];
        total = xmlNode.childNodes.length;
        for (i=0; i<total; i++) {
            image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
            description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
        }
        firstImage();
    } else {
        content = "file not loaded!";
    }
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
 
p = 0;
this.onEnterFrame = function() {
    filesize = picture.getBytesTotal();
    loaded = picture.getBytesLoaded();
    preloader._visible = true;
    if (loaded != filesize) {
        preloader.preload_bar._xscale = 100*loaded/filesize;
    } else {
        preloader._visible = false;
        if (picture._alpha<100) {
            picture._alpha += 10;
        }
    }
};
function firstImage() {
    if (loaded == filesize) {
        picture._alpha = 0;
        picture.loadMovie(image[0], 1);
        desc_txt.text = description[0];
        picture_num();
    }
}
function picture_num() {
    current_pos = p+1;
    pos_txt.text = current_pos+" / "+total;
}


some of you might remember the code from the kirupa tutorial.

this script loads a XML file which is formatted this way:

Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<pic>
<image>test.jpg</image>
<caption>testimage</caption>
</pic>
Now i want to load all pics mentioned in the XML file to be displayed in a stack (a vertical row) and in a frame from the library (via the attachmovie command)

what would I need to do? I'm totally stuck on this.

Thanks a lot in advance guys!

Attach Mc
Could anyone tell me how I can attach a movieclip instead of loading a.jpg from the code below. Any help would be appreciated.


ActionScript Code:
btn39_btn.onRelease = function() {
    loadThenGrow("images/portraits/port_20.jpg");
};
// LoadTheGrow function takes a target image name.
// Targets are hard-coded for the moment because I'm lazy
function loadThenGrow(img) {
    bg_square_mc._parent.holder_mc.removeMovieClip();
    bg_square_mc._parent.createEmptyMovieClip("holder_mc", 1);
    bg_square_mc._parent.holder_mc._visible = false;
    bg_square_mc._parent.holder_mc.onData = function() {
        if (this.getBytesLoaded() == this.getBytesTotal()) {
            this._visible = false;
            // Image fully loaded, grab dimensions and resize
            // background clip
            w = this._width;
            h = this._height;
            bg_square_mc.growTo(w+1, h+1, 10, _root.showHolder);
        }
    };
    bg_square_mc._parent.holder_mc.loadMovie(img);
}
function showHolder() {
    w = bg_square_mc._parent.holder_mc._width;
    h = bg_square_mc._parent.holder_mc._height;
    bg_square_mc._parent.holder_mc._x = bg_square_mc._x-w/2;
    bg_square_mc._parent.holder_mc._y = bg_square_mc._y-h/2;
    bg_square_mc._parent.holder_mc._visible = true;
}

GrRR Loop, Loop,loop
Hi ! I would like to know why when I goto publishing or otherwise. That when the program is run that the "loop" is always in the on mode. I have looked under preferences and I don't see it in there either. Can this thing be turned off somewhere by using scripts? Cause the last program I played with was supposed to "play and stop". It does work before the last frame is seen and then jumps over it when that script is activated. But then restarts the whole movie process all over again. But,now if I play the movie myself and I go and right click on the movie and turn off the loop it worksd just fine ... How do you turn that thing OFF????
ANYBODY KNOW??? HeLP!!
[Edited by Coke1bear on 12-26-2001 at 02:52 PM]

How O Attach A Movie?
I have a problem with attaching the movie. Line looks something like that: attachMovie( "pausa", "p", 100 )
Pausa is the linkage in Library (that should be OK).
When I hit CHECK SYNTAX I GET THIS:

******* You must export your movie as Flash 5 to use this action.
attachMovie( "pausa", "p", 100 );***********

HELP!!

Is It Possible To Attach Files?
Is it possible to attach files in a Flash interface? If not, what's a good alternative?

Attach Movie
Hi

Does anyone know why we choose to use Attach Movie instead of duplicate Movie ? what is the advantage?

Thanks in advance

MKit de HK

Attach Sound
Hello,
Could anyone tell me how to work with sound in flash 5
and how to make a continous background sound
Regards

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