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




Explain A Small Amount Of Script...



Hi-
i was doing a tutorial to help me understand the duplicateMovieClip() method, and i need some help with a portion.. I got this script to work:
code:
_root.box.onEnterFrame = function() {
n = 1;
while(n<300) {
_root.box.duplicateMovieClip("box"+n,n);
_root["box"+n]._x = random(550);
_root["box"+n]._y = random(150);
_root["box"+n]._alpha = random(100);
_root["box"+n]._yscale = random(150);
_root["box"+n]._xscale = random(150);
n++
}
}


the part i dont understand is where i'm setting the properties of the newly duplicated clips. for example,
code:
_root["box"+n]._x = random(550);


can someone explain the part inside the brackets? It looks like an array of some sort, but i just wanna make sure i understand this before i move on..

thanks,
-myk



FlashKit > Flash Help > Flash MX
Posted on: 11-06-2003, 10:37 AM


View Complete Forum Thread with Replies

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

Please Explain This Script In Small Piece Of Cake (_focusrest AND _name) Thanx
Please explain this script in small piece of cake (_focusrest AND _name) thanx a lot.

Can Some1 Please Explain _blank,_self,_parent,_top In Small Words?
I am a somewhat intelligent man. I know how to fill out an application at McDonald's I can write my name etc.etc. , but when it comes to those _blank,_self,_parent,_top they are like Criptonite for Superman.

I understand blank opens a new page.How about the rest. Can you help me please.
ThanX a bunch. Lots of great karma coming your way.
T.

PS but explain like you're explaining to your grandmother.

On Amount Loaded = Total Amount , I Want To Display Something Else.
I have a preloader for the movie, and while the preloader is loading, there is an animation going on. It says "Loading_", with the underscore flashing. I want to make the "Loading_" MC say something else when the amount loaded equals the total amount, in other words: when it reaches 100% loaded, i want "Loaded_" to change to "Finished". Can someone help me out?..I'm doing a website for a band and they want it done relatively soon.

Thanks,
David "O"

Small To Large To Small In Actionscript
Say I wanted an "a" to go from 100 xscale/yscale to 200 then back again as in normal tweening, how would I do this in actionscript? Here is what I thought of but didn't work:

if(this._xscale<>200 and x<>1){
this._xscale+=5
this._yscale+=5
}
}else{
x=1
}
if(x==1 and this._xscale>100){
this._xscale-=5
this._yscale-=5
}

Am I Blind..? Small Small Bugg But Where..
maybe i´ve got my eyes in my ass but I can´t see where it goes wrong...
works fine in flashplayer 6 but not 7 & 8

onClipEvent (enterFrame) {
loading = this.getBytesLoaded();
total = this.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = int(percent);
percentage = per+"%";
loadBar._width = per;
if (percent>99) {
_parent.gotoAndStop(2);
}
}


somebody?

tnx

Big MC Made Up Of Small MCs Not Reflecting Change Made To Small MC
Hi, I hope someone can help me. I have a large movie clip (screen size) that is made up of 30 small movie clips called 'element1'. I was hoping to load a small (screen size) external movie clip into this 'element1' movie clip and knock out the existing content. This it does, but because the large movie clip was made up of 30 movie clips I would have expected after the content of 'element1' was replaced with the external SWF file that the whole of the large movie clip (made up of the 30 small clips) would have changed to reflect the change in swapping over the targeted 'element1' movie clip. All that is happening is that only the targeted 'element1' is showing the swap. Do you have to refresh the screen or something?
Any help would be appreciated.

Cheers

Amount Of LoadMovie 's Possible.
I got a quick question for you all:

I built a main movie/ time line for the site that I am putting together, The way that I am doing is it, I am having a bunch of loadMovie's (swf's) that will load into my main interface. how many is too many, I have 26 diffrent swf's for diffrent sections. Is this okay. I hope so.


-gg.

Doing Something After A Certain Amount Of Time?
Hi there
I was wondering about the concept of executing code after a certain amount of time...
is this possible?

say, like count up 5 seconds, and then do something once the count reaches 5

you can do a for loop to count upto a finite number of say 1000, but whose to say how long that will take and it'll obviously be different depending upon the speed of the machine...

Doing Something Every X Amount Of Time
i'm trying to get an action to be performed every x amount of seconds but i'm totally lost how to do this.

i know the getTimer() function returns a time in milliseconds but where am i supposed to put the code?

please help!

Dup MC After X Amount Of Seconds
I'm trying to duplicate an MC every 1000 milliseconds...can I get sum aid with a code please...thanx alot...

Thanks everyone

Amount Of XML Tags?
Hello,

I've got an XML file that contains maps for my game. It's set up like this:


Code:
<maps>
<map>
<row></row>
<row></row>
</map>
<map>
<row></row>
<row></row>
</map>
</maps>
With the row tags containing data for the rows on the map. I want actionscript to be able to tell me how many <map> nodes there are. I've tried a bunch of different ways but I couldn't get it to work.

Max Amount Of AS/frame ?
Hi,
I would like to ask you what is the acceptable amount of actionscript in one frame? I have about of 10.000 coding lines and it seems to be ignored by Flash MX 2004

Any tips and tricks?

Thanks everybody!!!

Looping A MC For A Certain Amount Of Times
Pretty please....anyone....

What I am trying to do is I want my MC to loop for five times and then jump on to another frame (where the fadeout starts)

I have been trying my luck with a if else statement checking wether the variable loop has reached the value of 5 if yes I want it to jump on. I don't get any errors in the output but the darn thing won't stop looping...

can anyone help me please...?

Does Amount Of Commands Matter?
HI I have this button with on rollover, it does like 3 telltarget commands... does that affect how it works?
I say this because 1 thing doesnt work and the others do...

Large Amount Of Pictures
I am going to recieve a large amount of pictures (about 100). Should I put them in flash using the back next button or should I use another form of coding? The main point is to cycle through images by just clicking back/next in a popup window.
Thanks.

Loading Swf After Certain Amount Of Time
Hi,

I've created flash movie that loads a new swf after the current swf plays through. However, i'd like for the new swfs to load say... 30 seconds after the current one finishes, rather than immediately.

Rather than adding a long set of frames to each swf, I'm assuming there is a better way with actionscript to control how often/frequently a swf loads.

Any suggestions?

cheers!
Jen

Play Set Amount Of Frames Only?
I was just wondering.... is it possible to tell flash to play a certain range of frames?
What I mean is, could I make a button with a script that makes the playhead play frames 125 to 225 then play frame 350 and stop.
(without a stop command at frame 225... as other buttons may instruct to play beyond that)

This would make my life easier...

Thanks

@lex

Large Amount Of Swf Files
I have about 100 swf files.. and each swf file contains one frame.. I want to import every swf file so all the frames get to the same layer.. but when I try to import everyone, it's just creating one layer for each swf file.. how can I do so all swf files get on the same layer?


and all the swf files together create an animation so I don't want every swf file to be on the same frame.. but a frame by frame animation...how?

Restricting The Amount Of Characters?
I have a dynamic text box that I only want the first three characters showing. I know for input text you can put the max amount of characters, but for dynamic you can't. Any ideas?

Limited Amount Of Sounds?
Hi guys,

does anyone know if there is some limit imposed on the number of WAV sounds you can use in a Flash movie?

I'm building a multi layered background music system and it's all been going perfectly until the last three sounds were added.
These sounds just refuse to play, even though they are in the same MC as other previously imported sounds which play perfectly.

I'm just importing the sounds into the library and then setting the Sync option on frame 1 to Play.

Anyone know?

Play Certain Amount Of Frames
U have a animation (40 frames)
U have 3 buttons

If u klick on button1 the animation has to play 10 frames
If u klick on button2 ... 20 frames
if u klick on button3 ... 30 frames

if _currentframe == _totalframes back to frame one.
all starting from the last frame in view

I got this thing working but still i have one problem.
Each time the MC loops, the 10th frame of the first loop has become the 9th frame of the second loop and so on.

So the problem situates itself between the first and the tenth frame.
Becuz when u ask at frame 1 to goto frame 10 it has to view 9 frames and if u ask at frame 10 to goto frame 20 it has to view 10 frames.

any help with this ? or if ya know any other (better) way to do this plz let me know

tnx


here's the code
button: i=1 gotoandplay frame1

frame 1:
if (_root.HoofdMenu._currentframe != _root.HoofdMenu._totalframes) {
if (i%10 == 0) {
_root.HoofdMenu.gotoAndStop(i);
_root.buttonz.gotoAndStop(1);
} else {
_root.HoofdMenu.gotoAndStop(i);
i++;
}
} else {
i = 1;
_root.buttonz.gotoAndStop(1);
_root.HoofdMenu.gotoAndStop(i);
}

frame2: goto and play frame1

To Pull Only The Accurate Amount.
I am with a small problem, is the following one, I have my main file that this calling 10 swfs external, example in frame 1 calls one swf, in frame 150 calls another one, in frame 230 calls another one and thus it goes until completing the 10 swfs, I am using something thus for each swf "tran1_mc.loadMovie(_root.i11)", in the HTML if I to place 10 swfs it pulls normal, all certainty so far, but if in my HTML to say only it to pull 3 swfs, it pulls these 3 swfs and the remaining portion is blank, what necessary to make it is when to finish to show to this 3º swf it comes back to the first one, somebody has an idea of as I can make this?

Wait On Frame For X Amount (help Please)
Below is the code I am using....

SMALLER MOVIE 1
myFrameMove1=function(){
transitionbox1.play();
}
myInterval1 = setInterval(myFrameMove1,3000);

gotoAndStop(1);
clearInterval(myInterval1)


SMALLER MOVIE 2
myFrameMove2=function(){
transitionbox2.play();
}
myInterval2 = setInterval(myFrameMove2,3000);

gotoAndStop(1);
clearInterval(myInterval2)

I have a MAIN movie that has two buttons
each button loads a SMALLER MOVIE into place
the two SMALL MOVIE each have a setinterval
delay transition, this seams to work as long as
you do not view each movie more than once
in other words

click button 1

click button 2

and than click on button 1 again

after yo do this you will see the delay becomes sparatic
and changes at no set time.

There is a source file that will help

Please Help, Anyone!!!!!!!!

Controlling Amount Of Loops A Swf Does
I'm doing a banner ad and it has to loop 3 times.

So what I have is in my main timeline 3 movies: 1st movie loads some text say text1Mov . At the end of the text1Mov instance I have a go to the root and play the next frame which contains text2Mov and then to finalMov. What I want to do is have the main timeline go through the whole movie once and then load from text2Mov again and then finally load text2Mov again and from there play finalMov and stop at the end of that.

Here's the file so you can see what I'm trying to do:
http://www.rdesigncreative.com/temp

Any help appreciated thankyou.

Runtime: Amount Of Memory Used Or Available?
How do I find out the amount of memory being used by Flash at runtime? Or the amount available?

Thanks.

Determining Amount Of Motion
Greetings Peeps,

I'm a new guy, so go easy on me.

Right, i'm having some issues trying to get my head around making my webcam work with the new flash 8 BitmapData/GetPixel classes.

The idea is, you have a webcam input, then you divide that input into 12 square regions. (in a 4x3 formation)

I want each square to return a real time value depending on how much movement is happening within that square.
i.e. if there is a lot of movement in one square, it returns a high value,
if there is very little, or no movement in the square, return 0 or a low value.

----

Whilst typing this, i kinda thought of a rough algorithm of how this would work, but am a bit clueless on how to code it and whether it would be an efficient method. Here goe's anyway;

100 actionscript sampled pixels are evenly distributed in each of the squares,
so in the end, there would be 1200 pixels to be sampled (in real time) in the total project.
Anyway, changes in a sampled pixel would be flagged as a '1',
There would be a continous loop which counts the number of sampled pixels in each square which are flagged as 1.
So if all the 100 sampled pixels are changing (meaning movement), that square would return the value 100. etc etc...


Would the algorithm i've just come up with be feasable? or is there a more efficient method of returning movement values from each square?

Many thanks in advanced to anyone who could shed some light on my query.

Execute Certain AS After X Amount Of Seconds
I would liek to know how to exictute this line of Actionscript:

Code:
getURL("http://www.google.com" , "_self");
stop();
after 5 seconds.

Regroup Into New Arrays With Same Amount In Each
I have an array of buttons that will be created dynamically so I will not know how many buttons there is in total. When the buttons are created the button name gets put into an array (Code below is a slimed down version of this).

I need to know how to separate this array into groups of 3, not any less or more even at the end of the array or if it is not divisible by 3. I am making a navigation that is much like "Paging" in the code world but 3 buttons is all that can be seen at any one time. If I am going about this wrong or there is a better way please let me know.

Code that I have started and can not seem to get to make it do it:

Code:
var patronButtons:Array = new Array();
//patronButtons.push(Button1)
//patronButtons.push(Button2)
patronButtons.push(Button3)
patronButtons.push(Button4)
patronButtons.push(Button5)
//patronButtons.push(Button6)
patronButtons.push(Button7)
patronButtons.push(Button8)
//patronButtons.push(Button9)
//
var startX = 75
var spacing = 4
function createTheMenu(btnArray){
for(pb=0;pb<btnArray.length;pb++){
btnArray[pb].btnText.btnName.text = pb
btnArray[pb].btnText.btnShadow.text = pb
btnArray[pb]._x = startX
startX = startX+btnArray[pb]._width+spacing
}
}
createTheMenu(patronButtons)

Tracking The Amount Of Vistors
i would like to show the # visitor that user is to the site. any ideas on how to do this. thanks.

To Pull Only The Accurate Amount.
I am with a small problem, is the following one, I have my main file that this calling 10 swfs external, example in frame 1 calls one swf, in frame 150 calls another one, in frame 230 calls another one and thus it goes until completing the 10 swfs, I am using something thus for each swf "tran1_mc.loadMovie(_root.i11)", in the HTML if I to place 10 swfs it pulls normal, all certainty so far, but if in my HTML to say only it to pull 3 swfs, it pulls these 3 swfs and the remaining portion is blank, what necessary to make it is when to finish to show to this 3º swf it comes back to the first one, somebody has an idea of as I can make this?

THUMBNAILS And Their Amount On The Page
Hello,

I'd like to know how the thing, that I am now going to explain on the site www.designlicks.com, is made.
There is a several amount of thumbnails. Their number depends on the screen resolution or on the size of the window.
Anytime the screen resolution or the size of the window get smaller, the amount of those thumbnails gets smaller, too and the rest of them
moves to the other page, therefore you have to keep clicking button "next" to see all of them (thumbnails)
at the end. The question is, how this all is made. Thank you very much for any possible help. I will appreciate it.

Help With Amount Of Layers In A Movie
function attachNew(linkName, newName, depth, xvalue, yvalue, avalue) {
newAttach = _root.attachMovie(linkName, newName, depth);
newAttach._x = xvalue;
newAttach._y = yvalue;
newAttach._alpha = avalue;
}
attachNew("Frame", "frame", 1, 323, 323,0);



if i have more than 14
mc's attached i cannot add any more


so when i get to

attachNew("Example", "example", 15, 123, 123, 9);

nothing happens it does not place my movie clip

any advice?

Tracking The Amount Of Vistors
i would like to show the # visitor that user is to the site. any ideas on how to do this. thanks.

To Pull Only The Accurate Amount.
I am with a small problem, is the following one, I have my main file that this calling 10 swfs external, example in frame 1 calls one swf, in frame 150 calls another one, in frame 230 calls another one and thus it goes until completing the 10 swfs, I am using something thus for each swf "tran1_mc.loadMovie(_root.i11)", in the HTML if I to place 10 swfs it pulls normal, all certainty so far, but if in my HTML to say only it to pull 3 swfs, it pulls these 3 swfs and the remaining portion is blank, what necessary to make it is when to finish to show to this 3º swf it comes back to the first one, somebody has an idea of as I can make this?

Reducing Amount Of Optimization
I have successfully created a Flash animation that I would like to go in my site header. Since my site header has an image background, I used this same image as the background of my presentation. However, when I put the animation in the header, the two backgrounds no longer match, as the animation background is now a tad lighter. I know it is not a problem with the background, itself, since the image looked fine up until I published the .swf file. I have checked all of my Publish Settings, (with Jpeg Quality set to "100%"), and it doesn't seem like they would be causing this problem. It seems that, somehow, Flash is optimizing the file more than I would like.

If anyone has a take on what could be happening and how to fix this, your advice would be MUCH appreciated!

Read In The Amount On An Flv Or Mp3 That Has Loade
Hi. I am trying to monitor how much of an flv has loaded.

I have used this script:

var myProgressListener:Object = new Object();
myProgressListener.progress = function(eventObj:Object) {
trace(myProgressListener.progress);
trace(myClip.progress);
trace(this.progress);

};
myClip.addEventListener("progress",myProgressListener);

All of my traces come back as undefined. I don't understand - the MediaPlayer must know the information, otherwise the progress bar in the component would not work. Does anyone know how I can access the data?

M@)

To Pull Only The Accurate Amount.
I am with a small problem, is the following one, I have my main file that this calling 10 swfs external, example in frame 1 calls one swf, in frame 150 calls another one, in frame 230 calls another one and thus it goes until completing the 10 swfs, I am using something thus for each swf "tran1_mc.loadMovie(_root.i11)", in the HTML if I to place 10 swfs it pulls normal, all certainty so far, but if in my HTML to say only it to pull 3 swfs, it pulls these 3 swfs and the remaining portion is blank, what necessary to make it is when to finish to show to this 3º swf it comes back to the first one, somebody has an idea of as I can make this?

Pausing/Waiting For A Set Amount Of Time
I'm pretty sure theres some function to make it so that Flash pauses in the code for a certain number of seconds/milliseconds, but I can't find it in the help. Anyone know it and the syntax?

Certain Amount Of Points Till Next Level?
Hi guys, I'm currently working on a game and I have a little question for you all. In my game, I'm using a input named '/:score' to log points for when you shoot someone. It looks something like this: /:score = n = Number(n)+20; this makes it so it adds 20 points to the score. Now, my question is, say I wanted it so when the user gets to 200 points total, it goes to a frame I specify? Is there a way to do this? Can you all help me?

Thanks

Placing An X-amount Of Movieclips In Rows
Hi,

I'm trying to place an unknown amount of movieclips in rows. The mc's are generated from sentences typed in by the visitor. As I don't know how long the words or sentences will be I can't use a grid. But I still want to place the mc's containing words in rows (lines).
Here's the code:
-----------------------
onClipEvent (load){
// what word should this mc display?
naam = this._name;
item = naam.substring(5);
woord = _root.input_array[item];
// determine x and y position and width of the previous mc:
if (item > 0){
vorige_x = _root["woord" + (item-1)]._x;
vorige_y = _root["woord" + (item-1)]._y;
vorig_woord = _root["woord" + (item-1)].woord;
lengte = vorig_woord.length * 7;
this._x = vorige_x + lengte + 7;
}
// if one line is complete, go to the next line by increasing y position
while (this._x > 370){
this._y = vorige_y + 10;
trace(vorige_y);
trace(item);
this._x = 32;
}
}
-------------------
The code works fine until the while loop. Here it adds 10 pixels only once, making the rest of sentence go over the first line. I want to start a new sentense everytime this._x > 370. What can I do about this?

Hope i made myself clear and hope some of you guru's can help.
Thanks in advance, Danielle.

How Do I Read Different Amount Of Childs In A Node
I parse an xml-file with for example 4 childs with each an attribute.If each xml-file would have 4 childs every time than there is no problem reading the attributes, I can than write 4 lines:

var[0] = xmlfile.firstchild.attribute.ID;
var[1] = xmlfile.firstchild.nextsibling.attribute.ID;
..
var[3] =xmlfile.firstchild.nextsibling.nextsibling.attrib ute.ID;

The problem is that the next time my xmlfile can have 10 or 2 or even 425 childs.
So I need a routine that reads each firstchild's attribute into an array and than the nextsibling and the next sibling and so on... This routine needs to run for "childNode.Length"-times.

OK, but how do I actually read the nextsibling?? How do I change the "pointer" from :

xmlfile.firstchilde.attribute.ID
to
xmlfile.firstchild.nextsibling.attribute.ID;
to
..
xmlfile.firstchild.nextsibling.nextsibling.attribu te.ID

Controling The Amount Of Times A MC Can Play¿?¿?¿?¿?¿?¿?¿?
Hello Here is what I have a button and one movie clip. I want the button to start the movie clip only twice. so if you click the button the MC plays if you click agian the MC plays again but if you click a third forth fifth etc.... the MC will not play again. I know this is possible. Thanks for you help and time

your friend
montara

I Won’t To Make A Lottery With Random Amount
Could someone help me with this matter?

I won’t to make a lottery with random amount

Example 100,200,500,1000

3 numbers would appear at the same amount

Example 100, 100, 100

Is there a god action script ho could execute this

Adding Commas To A Dollar Amount
anyone know of some existing code that parses a dollar amount and adds commas to it? ie 12000 equals 12,000

Thanks!

AP

How To Get .length Of Array (not Amount Of Characters)
Does anyone know how to get the .length of an array without it returning the amount of characters??

Here is my code:

plop = _root.titles_array.length;

plop returns 117 which is the total amount of characters in the array instead of the amount of objects in the array, which is 8.

Cheers!

Calling A Function Every Amount Of Time
I want a function to be called every certain amount of seconds ... and Ill eventually want it to be a random number between like 2-10 seconds ... how would I do that?

Stopping A Frame For Amount Of Time
I have a movie I'm making and I need to have the movie hold at frame 20 for 4 seconds then continue to play the rest of the movie. Can anyone shed some light on this? Thank you so much.

Trouble With Large Amount Of XML Data
hi here is the code i use in frame 1 to create, load, parse and display my xml file.

xml layout is this:
</techno>
<entry id="1">
<latest>0</latest>
<artist>Autechre</artist>
<album>Draft 7:30</album>
<label>Warp</label>
<year>2003</year>
<genre>0</genre>
</entry>
</techno>

actioscript is this:

function myOnLoad (success) {
if (success) {
dataxml = "";
list = new Array()
loadTxtBox();
}
}

function display(){
var n = 0;
// while (n < list.length){
while (n < 10){
dataxml = dataxml + list[n][1]+" - "+list[n][2]+" - "+list[n][3]+" - "+list[n][4]+"
"
n++
}
DisplayModule.listDisplay = dataXML;
}

function loadTxtBox () {
var i = 0;
var j = 0;
var k = 0;
var l = 0;
while (i < xml1.firstChild.childNodes.length) {
liste[l] = new Array()
if (xml1.firstChild.childNodes.attributes.id != null) {
j = 0;
k = 0;
while (j < xml1.firstChild.childNodes.childNodes.length ) {
if (xml1.firstChild.childNodes.childNodes[j].nodeName != null) {
list[l][k] = xml1.firstChild.childNodes.childNodes[j].toString();
k++;
}
j++;
}
l++;
}
i++;
}
display();
}

if (getTimer() < 100000) {
xml1 = new xml ();
DisplayModule.listDisplay = "Loading data...";
xml1.onLoad = myOnLoad;
xml1.load("techno.xml");
}

stop();


simple enough, everything works fine with 10 entries but i have 348 entries to parse and display. The infamous alert appears saying the script could render the application unresponsive.

Now tell me, are my methods efficient? Could they be the cause of my trouble or do i have to rearrange the xml file template? Maybe i should segment the file, if so whats the best way to do it? xml is great but is it for large file?

thanks

Working With Large Amount Of Text
I am working with a large amount of text ( abound 9 pages word ), and flash became really slow . Is that anyway that I can compress text or made it faster? I used scroll box component and some text is missing ??

Please help me, please !!!! hu hu hu

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