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








Creating A Loop And Filling


Evening,
I'm working on a movie that has multiple XML nodes. I have a loop that goes through and re-creates the MC for how ever many childNodes there are. That works fine and it re-creates the MC. But the problem I run into, is in the 2 MC's it creates, it fills it with the same data.

I need it to fill it with both corresponding info and I'm not sure where I am going wrong. Could anyone point me in the right direction?

XML I am bringing in:

Code:

<footer>
<item number="1">OncoLog, February 2004, Volume 49 No.2.</item>
<item number="2">Centers for Medicare and Medicaid Services.</item>
</footer>



Actionscript to create the loop:

Code:

for (var f = 0; f<footer.childNodes.length; f++) {
var item_mc = mcFooter.attachMovie("MC_itemFooter", "item"+item_count, item_count);
item_mc._y = item_count*item_spacing;
item_count++;
item_mc.txtfNum.text = footer.firstChild.attributes.number;
item_mc.txtfCopy.text = footer.firstChild.firstChild;
}



And the above displays the following:
Quote: 1. OncoLog, February 2004, Volume 49 No.2.
1. OncoLog, February 2004, Volume 49 No.2.
Instead of:
1. OncoLog, February 2004, Volume 49 No.2.
2. Centers for Medicare and Medicaid Services.

Any ideas why? I've literally been on this ONE ITEM for 4 hours now and can not figure out what the problem is. It's almost 3am and I have to get up in 3 hours for work.

ANY help someone can give me is HUGE! This loop function is basically the project and all I need to do is get it down once, then the rest is smooth sailing!

Thanks for any help!




DevShed > Flash Help
Posted on: January 21st, 2008, 02:26 AM


View Complete Forum Thread with Replies

Sponsored Links:

Creating A Button, Then Filling It With A Box In AS 2 ?
Hello guys,

I'm a young designer with only a year of pro experience in flash design, and I already made some good progress during that time.
however, I'm the only one in my company with some knowledge of flash and AS, and today I'm encountering a problem that long hours of research did not solve.
I'm working on some banners for a marketing campaign (already did several without problems), but I've had a very, very stupid idea : automatizing the clicktag button creation.

what I need is a script that creates a button the size of the stage, then creates a transparent fill inside and attaches some code on release, etc, for that button to work.

what I have achieved so far : a working script creating a fill in a movieclip and using it as a button.
the only little issue is that for the companies we work with, it HAS to be a button, and it HAS to have the code attached to it directly with an on (release) function.

I've tried embedding the movie clip in a button, resizing the button, trying to refresh it, but it seems like it only keeps the hit zone it had at creation, and if the button is empty, then there's no hit zone :s

I'd love some help on this, folks, and if someone around the world is willing to criticize my work, I'm attaching my actual code to this message :)







Attach Code

--- working but using a movieclip -------

onClipEvent (mouseUp) {
var clicklist:Array = Array(clickTag, clicktag, clickTAG);
for (i = 0; i < clicklist.length; ++i) {
var tempclic:String = clicklist[i];
if (tempclic != undefined && tempclic.substr(0, 5) == "http:") {
getURL(tempclic, "_blank");
}
}
}

drawRectangle(this, Stage.height, Stage.width, 0xFFFFFF, 0);
function drawRectangle(target_mc:MovieClip, boxWidth:Number, boxHeight:Number, fillColor:Number, fillAlpha:Number):Void {
with (target_mc) {
beginFill(fillColor, fillAlpha);
moveTo(0, 0);
lineTo(boxWidth, 0);
lineTo(boxWidth, boxHeight);
lineTo(0, boxHeight);
lineTo(0, 0);
endFill();
}
}

View Replies !    View Related
Filling Arrays With A For Loop
In C++ I would do something like this:

for(i=0; i<200; i++)
{
MyArray[ i ]=i;
}

so MyArray[0]=0, MyArray[1]=1, ect...
how would I do something similar in actionscript?

View Replies !    View Related
Creating Text-filling Rollovers
Hi,
I'm a web designer and I have a client who would like rollover buttons like on this site: http://www.elec.com.au . To me it looks like the text fills with red from the middle outwards when you rollover it....would the red bit just be a movie clip behind the text? I'm not really sure about it, if anyone has an answer that would be great!

Cheers,
Grant

View Replies !    View Related
URGENT HELP Filling In Arrays With Loop?
hi guys!

i need your help!

i have an xml file that has reference to multiple filenames eg "filename1.swf, filename2.swf, filename3.swf" etc and im needing to put it into an array dynamically, perhaps using a loop?

this is my array:
var allFileNames:Object = {var1:"tmp image.swf", var2:"tmp image 2.swf", var3:"filename3", var4:"filename4",var5:"filename5",var6:"filename6" };


how do i dynamically fill in this array?

cheers!

View Replies !    View Related
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

View Replies !    View Related
Creating A Loop
i want to create a film strip that will loop continuously in flash stage. the film strip will start from the left bottom corner of the screen, will start in a blank screen, then it will just loop continuously. can anyone please help me regarding this?

View Replies !    View Related
[F8] Creating A For Loop
I have a bit of code already but I need to create a "for loop" for this set of code. I need it to loop 5 times. How do I write that?

View Replies !    View Related
Creating A Loop
Hello Fans, Friends and Well Wishers,

Got a question for you
I want to create a loop for this timer, which will create a blink type situation.
Something like this.


Code:
onClipEvent(load){
startTime=getTimer();
this._visible = false;
}

onClipEvent(enterFrame){
if((getTimer()-startTime)>500){
this._visible = true;
startTime=getTimer();
}

onClipEvent(enterFrame){
if((getTimer()-startTime)>500){
this._visible = false;
startTime=getTimer();
}
but I need to fit some of it into a loop next. I'm not sure which loop type to use and where I can find information on it.

If anyone can help I'd really appreciate it.
Thanks.

View Replies !    View Related
Creating A Loop
is there a way to condense the following into a loop?

fillMcMonth1 = new LoadVars();
fillMcMonth1.load("textfiles/forrent/month1.txt");
fillMcMonth1.onLoad = function(success) {
if (success) {
_root.mcForRent.mcCalendar.mcMonth1.txMonth.text = this.content;
_root.mcForRent.mcCalendar.mcMonth1._visible = true;
} else {
}
};
fillMcMonth2 = new LoadVars();
fillMcMonth2.load("textfiles/forrent/month2.txt");
fillMcMonth2.onLoad = function(success) {
if (success) {
_root.mcForRent.mcCalendar.mcMonth2.txMonth.text = this.content;
_root.mcForRent.mcCalendar.mcMonth2._visible = true;
} else {
}
};

View Replies !    View Related
Creating A Scene Loop
Hello all,

i'm not the best actionscripter in the world and im having problems creating a simple loop!! All i would like to do is play a particular scene 5 times and the move on to the next scene. I just cant seem to get the code right! Any1 care to help'??

Mark Regler

View Replies !    View Related
Creating A Scene Loop
Hello all,

i'm not the best actionscripter in the world and im having problems creating a simple loop!! All i would like to do is play a particular scene 5 times and the move on to the next scene. I just cant seem to get the code right! Any1 care to help'??

Mark Regler

View Replies !    View Related
Creating A Seamless Swf Loop?
hello, I created a swf loop of a galloping horse (Flash 5 on mac os 9). When I view the swf, however, I get flash of white as the file reaches the end of the loop and begins again. How can I avoid this jag in the loop and just have it be seamless? The cycle is 30 fps (it's going to video eventually), and the animation is 10 frms of motion, repeated 3 times, for a total of 30 frames. I can email the swf if someone needs to see exactly what I'm talking about. Thanks in advance,

Jennifer

View Replies !    View Related
Creating A Loop That Counts
Hi, I need to set up a loop that will count to a certain number then cause an action. Is there a specific actionscript command that does this or should i set up a loop over the space of two frames to do this?

If it is the second one and you have the code could you post it up? thanks

Q

View Replies !    View Related
Creating A Cloud Loop
Hi im trying to create a loop of clouds, I ripped one from a flashkit
movie to see what it was like but it doesn't loop smoothly, can anyone
suggest a software package that I can create looped cloud animations???

if anyone want to see the sort of thing im creating have a look at the swf at http://www.cotc.co.uk/sky.swf

View Replies !    View Related
Creating A Loop Seems Impossible
I wrote an actionscript for shifting up the movie clips on command, but then I wasn't able to get it works more than once!

View Replies !    View Related
Creating Vars With Loop
I am trying to save myself some time by creating a loop that makes variables. I have tried several different ways but none work. This is what I have tried:

Code:
//Attempt 1
for (v = 1; v <= 40; v++){
var this["s"+v+"Owner:Number"] = 0;
}
//Attempt 2
for (v = 1; v <= 40; v++){
this["var s"+v+"Owner:Number"] = 0;
}
//Attempt 3
for (v = 1; v <= 40; v++){
this["var s"+v+"Owner"]:Number = 0;
}
//Attempt 4
for (v = 1; v <= 40; v++){
var this["s"+v+"Owner"]:Number = 0;
}

I am trying to make a variable called s(number)Owner. How can this script work?

View Replies !    View Related
Creating Random Loop
Hi. I'm really green on actionscript. I'm trying to create a continuous looping animation that draws from random animations within a single movieclip. The basic idea of the animation is a guy answering several different phone calls. I want the phone calls to come in random order as you sit on the animation, which will be the front page of the website. This also involves leaving a 6 second pause between calls as well. The calls are different lengths. I plan to apply this method to actions that occur in the background as well but we'll start simple.

If someone could tell me how to set up some kind of "random draw" system that draws from a group of set keyframes within a movieclip that would be awesome.

Andy

View Replies !    View Related
Help Creating A Detail Loop
i have a problem and cant figure how i should go about it, i have on a page a image and should have the following function, when i move the mouse over the image it show a more detailed version of the image and a different area, when i move the mouse the image updatges, its like a loop the zooms in 2 times. i added a image to explain what i mean, anyone has some ideas on how to realize that would be great.

Anton

i am on Flash CS3 pro

View Replies !    View Related
Creating AddEventListener Within Loop
Hello,
I'm trying to create event listener by using loop as shown below.
Everything works fine except MouseEvent.CLICK addEventListener.
menuInfo variable contains part of defined instace name.
cURL contains full URL to link.

If I trace menuInfo variable, it outputs correctly in order as I exptected.
But last event overwrites everything to last element of xList (contains XML list).
How do I make this work correctly?
Please somone advise.
Thank you.



Code:

function createMenuEventListener(xList:XMLList):void
{

for each (var menuInfo:XML in xList)
{
//trace(menuInfo);
this["main_mc"]["tab_" + menuInfo + "_btn"].buttonMode = true;
this["main_mc"]["tab_" + menuInfo + "_btn"].addEventListener(MouseEvent.ROLL_OVER, menuOver);
this["main_mc"]["tab_" + menuInfo + "_btn"].addEventListener(MouseEvent.ROLL_OUT, menuOut);
this["main_mc"]["tab_" + menuInfo + "_btn"].addEventListener(MouseEvent.CLICK, function(){navigateToURL(new URLRequest(cURL + "pg=" + menuInfo), "_self");});

}

}

View Replies !    View Related
Creating MovieClip In Loop
Hello all,
I've a big problem, I'm creating movie clips during a loop, and then I attach others movies to the created MC. The problem is that : only the last MC is created.
Perhaps a piece of code should be more useful than my poor English :

Code:
var curCarre:MovieClip;
var curBoule:MovieClip;
for (i=0;i<10;i++){
curBoule=this.attachMovie("boule", "boule"+i,_root.getNextHighestDepth());
curBoule._x=30*i;
curBoule._y=30*i;
for(j=0;j<5;j++){
curCarre=curBoule.attachMovie("carre", "carre"+j, _root.getNextHighestDepth());
curCarre._x=10*j;
curCarre._y=10*j;
curCarre._width=10;
curCarre._height=10;
}
}
Unefortunately I can't give you the .fla file, but I hope it'll be enough.

View Replies !    View Related
Creating Objects In A For Loop
This piece of code gives me an error because i have an equation on the left side of the equal sign, logically it makes sense, but flash doesn't like the code how would i do some thing like this?
ActionScript Code:
for (i=1; i<=10; i++) {
eval("dynamicObject"+i) = new Object();
}

View Replies !    View Related
For Loop Not Creating Movieclip At 0?
Hi,

I have a for loop that creates several movieclips with textfields inside. Everything works great the applications shows all movieclips except the first one that should of been initialized. I checked the debugger and all movieclips where created except "mc0". Here's some code.


Code:
for (i=0; i<total; i++) {
//create textobject and format attributes for entries
var entryTextFormat = new TextFormat();
entryTextFormat.font = "Helvetica";
entryTextFormat.size = 16;

//create textobject and format attributes for user names
var userTextFormat = new TextFormat();
userTextFormat.font = "Helvetica";
userTextFormat.size = 14;
userTextFormat.color = "0xff0099";
userTextFormat.italic = true;

// create entry textfileds and mc's
// create empty movieclip
_root.createEmptyMovieClip("mc"+i,200+i);
_root["mc"+i]._y = pos=pos+100;
//create textfield inside of MC and set attributes
_root["mc"+i].createTextField("txt"+i,200+i,0,0,500,400);
_root["mc"+i]["txt"+i]._quality = "BEST";
_root["mc"+i]["txt"+i].multiline = true;
_root["mc"+i]["txt"+i].wordWrap = true;
_root["mc"+i]["txt"+i].embedFonts = true;
_root["mc"+i]["txt"+i].text = userEntry[i];
_root["mc"+i]["txt"+i].selectable = false;
_root["mc"+i]["txt"+i].setTextFormat(entryTextFormat);
trace(i);
}
I'm sure it's something I am over looking, I can't seem to figure it out. Thank you in advance.

View Replies !    View Related
Creating Variables Within A For Loop
I'm trying to create 10 variables in a for loop... for some reason it's not working:


Code:
public var maxAmountReqjecs:Number = 10;// defines the maximum allowed amount of reqjecs

for ( var i = 1; i <= maxAmountReqjecs; i++ ){
public var ["reqjecActor"+i]:Actor;// declare reqjecActor
}
Can someone tell me what the correct syntax looks like?

View Replies !    View Related
Creating AddEventListener Within Loop
Hello,
I'm trying to create event listener by using loop as shown below.
Everything works fine except MouseEvent.CLICK addEventListener.
menuInfo variable contains part of defined instace name.
cURL contains full URL to link.

If I trace menuInfo variable, it outputs correctly in order as I exptected.
But last event overwrites everything to last element of xList (contains XML list).
How do I make this work correctly?
Please somone advise.
Thank you.



Code:

function createMenuEventListener(xList:XMLList):void
{

for each (var menuInfo:XML in xList)
{
//trace(menuInfo);
this["main_mc"]["tab_" + menuInfo + "_btn"].buttonMode = true;
this["main_mc"]["tab_" + menuInfo + "_btn"].addEventListener(MouseEvent.ROLL_OVER, menuOver);
this["main_mc"]["tab_" + menuInfo + "_btn"].addEventListener(MouseEvent.ROLL_OUT, menuOut);
this["main_mc"]["tab_" + menuInfo + "_btn"].addEventListener(MouseEvent.CLICK, function(){navigateToURL(new URLRequest(cURL + "pg=" + menuInfo), "_self");});

}

}

View Replies !    View Related
Creating For Loop For A Boolean
Hi,

I'm still a beginner to AS so pardon me if this may sound simple...

I've created 16 booleans with all set to false.

Now with a for loop, I'm trying to create 16 buttons, and when each button is pressed, the respective boolean relative to that button will change to true. Looks something as below:

Somehow, this doesn't work...can someone point out the error in this coding? Thanks very much!










Attach Code

for (var i = 1; i<=16; i++) {
this["button"+i].onPress = function() {
this["status"+i] = true;
}
}

View Replies !    View Related
Dynamic MC Creating In For Loop
can someone please explain to me how I can create a movieclip, then create n children to the movieclip. In the following code, if i use 'this' instead of a mc id [matrix] then it works, but when i try to createEmptyMovieClip using matrix. the children are overwritten.

What I want to acheive is one movie clip with n children that i can move and all its children will move in unison, and another mc that sits in a static position above the moving clip.


thanks,
Maurice









Attach Code

// this code produces 9 clips but on the root level
for (var i = 0; i < 9; i++)
{
var mc = this.createEmptyMovieClip('clip_' + i, getNextHighestDepth());
}

// this code produces one clip inside the matrix clip
// what i want is 9 clips inside the matrix clip
matrix = this.createEmptyMovieClip('matrix', getNextHighestDepth());
for (var i = 0; i < 9; i++)
{
var mc = matrix.createEmptyMovieClip('clip_' + i, getNextHighestDepth());
}

View Replies !    View Related
Creating A Loading Loop
I'm trying to create a simple loading loop to be contained in a scene before another scene. The scenes are in the correct order in my Scene panel, but when the movie plays back (even with no looping code), Flash will only play the first scene, not the second.

Why won't it play both scenes,one after the other?

View Replies !    View Related
Creating Arrays In A For Loop
Does anybody have experience with creating multiple arrays in a for loop?
This doesn't work :

for (i=0; i<catNum; i++) {
var arr(i):Array = new Array ()
}

this neither :

for (i=0; i<catNum; i++) {
idForSet = i
var arr:Array = new Array ()
myArr = "arr"+i
}

View Replies !    View Related
Creating A Loop From Video Cd?
Is it possible? I know I can record wave files by playing the video cd and use a microphone, but the sound quality is totally ****. Can anyone tell me other ways of doing that?

View Replies !    View Related
HELP Creating Image Loop.
Hey guys,

I'm looking for a little help with a flash enhancement on a site.

It consists of the following:
1. a text animation that is 50 frames long that will animate first.
2. 5 images that will animate with a transition and show up under the previous animation.
3. an animation that is 158 frames that will be used as a transition.


I am having trouble figuring out the best way to make the image mask animate and have another image show up under that transiton.

Any help will be appreciated, thanks!

View Replies !    View Related
Creating Tweens In A Loop
Hi All,

I'm stuck on trying to create a bunch of motion tweens in a loop
(to create an infinitely scrolling puzzle):

I know the 'var' part of this doesnt work..


Code:
for (x=1; x<20; x++) {
var ["myTween"+x]:Object =
new Tween(["myMC"+x], "_y", start, end, duration, true);
}
so I tried to put the tweens in an array:

Code:
hitTween = new Array();
for (x=1; x<20; x++) {
myTween[x] = new Tween(["myMC"+x], "_y", start, end, duration, true);
hitTween[x].onMotionFinished =
function() {trace("here we go again");};
}
But that doesn't seem right either, the tweens don't start visually in this case. However, the onMotionFinished function does get triggered.

I'd appreciate any pointers in the right direction, thank you!


Thanks for reading my 1st post!

Cheers,
Hofuzz

View Replies !    View Related
AS2 Creating Objects In A For Loop
This piece of code gives me an error because i have an equation on the left side of the equal sign, logically it makes sense, but flash doesn't like the code how would i do some thing like this?

ActionScript Code:
for (i=1; i<=10; i++) {    eval("dynamicObject"+i) = new Object();}

View Replies !    View Related
Creating Year Variables With A Loop?
Hello,

I need to create varaibles from 1995 to the Current Year. Of course I know how to create the vars like:
Var1 = 1995
Var2 = 1996
Etc...

But after building this I do not want to have to update the code ever year. So, can anyone tell me how to declare the vars with a loop upto the current year??

Thanks

View Replies !    View Related
Creating Time Variables With A Loop?
Hello,

I want to create a loop, which would create time variables.

What I mean is I would like to start with 6:00 am go up like:

6:00 am
7:00 am
8:00 am

ect

here is my loop thus far, which is not much

for (start=0; start<=12; start++) {
this["b"+start] = xHour}

I am not sure what to do? Please help. Thanks,

View Replies !    View Related
Creating Buttons That Activate Upon Loop
I have a movie that I am currently finishing. At the end of the animation, I need it to loop back to a certain frame. That's easily achievable with "gotoAndPlay".

But....

What I need is a button (easy to make and name) that activates after the first play through which essentially becomes the exit button from that loop.

How is that done ? - is there a special actionscript command that makes a button appear/be visible and activated ?


Additionally, upon further loops, I want the exit button to change appearance. Say I had buttons, each named exit 1, exit 2 etc.

How is that done ?

Any help gratefully appreciated.

View Replies !    View Related
Creating Classes Inside A For Loop
want to create 10 instantces of this class using the "I" in the name. this results on syntax error, how is it done?


Code:
for (var I = 1; I<10; I++) {
var "test"+I:testClass=new testClass()
}

View Replies !    View Related
Creating A Loop To Dynamically Update
I am creating a training interface which will have a list of categories on the left which needs the option to grow when a user decides to add new categories to the list. This interface will function much like the macromedia on demand training section:

http://www.macromedia.com/macromedia...?id=245&type=2

Here is a sample of the code that I have so far. I have all of the images and text reading from an external xml file.

// define our variables
var oXML;
var tNodes;
var xmlPath = "xml/categories.xml"; //

// define our xml object and load up the naughty word file
menuXml = new XML();
menuXml.ignoreWhite = true;
menuXml.onLoad = function() {
menuItem = this.firstChild.childNodes;
for (var i=0; i<menuItem.length; i++) {

item._x = 0;
item._y = 20*i;
item.itemLabel.text = menuItem[i].attributes.name;
item.myUrl = menuItem[i].attributes.url;
blueBar1.onPress = function() {

blankMC1.attachMovie("blueBar", "blueBar1" + i, i);
// THIS IS THE LINE OF TEXT THAT WILL NEED TO BE CHANGED "loadMovie("scroll1.swf", "blankTraining1");" SIMPLY CHANGE THE NAME OF THE .swf FILE TO THE FILE THAT YOU WOULD LIKE TO HAVE PLAY
loadMovie("scroll1.swf", "blankTraining1");
}
blueBar2.onPress = function() {
blankMC2.attachMovie("blueBar", "blueBar2" + i, i);
// THIS IS THE LINE OF TEXT THAT WILL NEED TO BE CHANGED "loadMovie("scroll2.swf", "blankTraining2");" SIMPLY CHANGE THE NAME OF THE .swf FILE TO THE FILE THAT YOU WOULD LIKE TO HAVE PLAY
loadMovie("scroll2.swf", "blankTraining2");
}
etc.

Thanks

View Replies !    View Related
Creating A Loop To Dynamically Update
I am creating a training interface which will have a list of categories on the left which needs the option to grow when a user decides to add new categories to the list. This interface will function much like the macromedia on demand training section:

http://www.macromedia.com/macromedi...l?id=245&type=2

Here is a sample of the code that I have so far. I have all of the images and text reading from an external xml file.

// define our variables
var oXML;
var tNodes;
var xmlPath = "xml/categories.xml"; //

// define our xml object and load up the naughty word file
menuXml = new XML();
menuXml.ignoreWhite = true;
menuXml.onLoad = function() {
menuItem = this.firstChild.childNodes;
for (var i=0; i<menuItem.length; i++) {

item._x = 0;
item._y = 20*i;
item.itemLabel.text = menuItem[i].attributes.name;
item.myUrl = menuItem[i].attributes.url;
blueBar1.onPress = function() {

blankMC1.attachMovie("blueBar", "blueBar1" + i, i);
// THIS IS THE LINE OF TEXT THAT WILL NEED TO BE CHANGED "loadMovie("scroll1.swf", "blankTraining1");" SIMPLY CHANGE THE NAME OF THE .swf FILE TO THE FILE THAT YOU WOULD LIKE TO HAVE PLAY
loadMovie("scroll1.swf", "blankTraining1");
}
blueBar2.onPress = function() {
blankMC2.attachMovie("blueBar", "blueBar2" + i, i);
// THIS IS THE LINE OF TEXT THAT WILL NEED TO BE CHANGED "loadMovie("scroll2.swf", "blankTraining2");" SIMPLY CHANGE THE NAME OF THE .swf FILE TO THE FILE THAT YOU WOULD LIKE TO HAVE PLAY
loadMovie("scroll2.swf", "blankTraining2");
}
etc.

Thanks

View Replies !    View Related
Dynamically Creating TextFields With Loop...
Hi Everyone, I have a problem that I think should be easy to sort but I just can't figure it out and hope someone can help.

I am trying to create a list of textfields using actionscript which import text from an external text file. To do this i am using a loop and the following script...


Code:
loadVarsText.onLoad = function() {
for (i=0; i<3; i++) {
y = 80+i*120;
trace("y = "+y);//traces the y location of the text field
this.createTextField("priceText_"+i, i+200, 210, y, 200, 300);
trace(["priceText_"+i]);//working fine
["priceText_"+i]text= this["price"+i];
trace(this["price"+i]);//traces the text from the external file
}
If I change ["priceText_"+i]text= this["price"+i];
to say
priceText_1.text=this["price"+i];
then the text field appears (for i=1) in the correct place. ["priceText_"+i] is currently an object which I am still not totally clear on so maybe this is the problem? Everything else seems to be ok though....

Any ideas?

View Replies !    View Related
Creating New Classes In Loop Issue
Hi,

Here's what I want to do and I have no idea how...

Version: Flash 8 Basic (PC)

Question: How do you create a class file and have that class file load an image into it so that when you create a instance of the class on the root, you get a movieclip on the screen?

Need: Using a For loop, I want to create movieclips on the root using a movieclip in the library as a base. The source movieclip is sitting in the library with a linkage id of "mcButton". mcButton right now is a blank movieclip with a tie to a class file.

What I did: I created a class file that I tied to this movieclip (specified at the same place where you specify linkage id). I create a new class in actionscript on the root. Example:

code:
var oButton:Button = new Button("test.jpg");


In the initialization of the class, it calls for a filename which then it creates a movieclip and loads that graphic into it.

Issue: When I test it, the loop runs and the classes seem to be creating but I see nothing on the screen. I don't really understand how I should approach this and what to do.

Help is much appreciated!

Thanks!

View Replies !    View Related
Creating Unique TextFields In A For Loop.
I have a for loop that runs depending on the length of an XML file. What I want to do is create a unique text field for each run through of the loop, and give it it's own position on the stage, and finally assign it the text from an external text file that is specified in the XML file. Everything I know how to do except creating the textfields.


Quote:




for(var i:int = 0; i < blogXMLList.length(); i++)
{
var txtHolder:TextField = new TextField();
txtHolder.x = textX;
txtHolder.y = textY;
txtHolder.width = textX;
txtHolder.height = textY;
txtHolder.multiline = true;
txtHolder.wordWrap = true;
textX += 50;
textY += 50;
addChild(txtHolder);

blogPostRequest = new URLRequest(blogXMLList[i].attribute("file"));
blogPostLoader.load(blogPostRequest);
blogPostLoader.addEventListener(Event.COMPLETE, loadTXT);

function loadTXT(event:Event):void
{
txtHolder.text = event.target.data;
}
}




This code creates only one Text Field, but then replaces it's text with new text with each run through. Please help, this has been annoying me for quite a while.

View Replies !    View Related
Dynamically Creating Movieclips In For Loop
hi all,

can some one please tell me why this gives 1 movie clip, the last one that is created. The mc variable inside the for loop is being overwritten


PHP Code:




var spacing = 38;
var rows = 3;
var columns = 3;
var backColor = 0xFF0000;

var xPos = 0;
var yPos = 0;
var col = 1;
var clipw = 150;
var cliph = 100;

matrix = this.createEmptyMovieClip('matrix', getNextHighestDepth());
menu = this.createEmptyMovieClip('menu', getNextHighestDepth());

for (var i = 0; i < 9; i++)
{
    var mc = matrix.createEmptyMovieClip('clip_' + i, getNextHighestDepth());
    mc.beginFill(backColor,100);
    mc.moveTo(0,0);
    mc.lineTo(clipw,0);
    mc.lineTo(clipw,cliph);
    mc.lineTo(0,cliph);
    mc.lineTo(0,0);
    mc.endFill();
    mc._x = xPos;
    mc._y = yPos;

    if (((i + 1) % columns) == 0)
    {
        xPos = 0;
        yPos += cliph + spacing;
    }
    else
    {
        xPos += clipw + spacing;
    }
}







and this gives me 9, which is what I want, but I want them all as children of matrix, as I want to slide the matrix around, and have all the children move in unison.


PHP Code:




var spacing = 38;
var rows = 3;
var columns = 3;
var backColor = 0xFF0000;

var xPos = 0;
var yPos = 0;
var col = 1;
var clipw = 150;
var cliph = 100;

matrix = this.createEmptyMovieClip('matrix', getNextHighestDepth());
menu = this.createEmptyMovieClip('menu', getNextHighestDepth());

for (var i = 0; i < 9; i++)
{
        /* changed matrix.createEmpty to this.createEmpty */
    var mc = this.createEmptyMovieClip('clip_' + i, getNextHighestDepth());
    mc.beginFill(backColor,100);
    mc.moveTo(0,0);
    mc.lineTo(clipw,0);
    mc.lineTo(clipw,cliph);
    mc.lineTo(0,cliph);
    mc.lineTo(0,0);
    mc.endFill();
    mc._x = xPos;
    mc._y = yPos;

    if (((i + 1) % columns) == 0)
    {
        xPos = 0;
        yPos += cliph + spacing;
    }
    else
    {
        xPos += clipw + spacing;
    }
}







thanks,
maurice

View Replies !    View Related
Creating A Loop To Dynamically Update
I am creating a training interface which will have a list of categories on the left which needs the option to grow when a user decides to add new categories to the list. This interface will function much like the macromedia on demand training section:

http://www.macromedia.com/macromedi...l?id=245&type=2

I need to also have this as a dynamically updateable interface. Any help or suggestions will help.

Thanks

View Replies !    View Related
How To Get Different Values From Each Movieclips Creating In A Loop.
Hi,


Iam loading the attribute values of from an XML file and according to the number of nodes I am creating movieclips.

Inside the movie clip I am creating squares and filling the color value from the XML.

Now the problem is that I want to trace the color value of the first square if I click on that ... and trace the second color value if I click on the second square(movieclip).

Here is my code....

importColorValue = new XML();
importColorValue.ignoreWhite = true;
importColorValue.onLoad = function(success)
{
if (success)
{
var depth = 0;
var nextY = 10;
count = 0;

var colorvalue = importXMLtemplate.firstChild.firstChild;
var attr = colorvalue.attributes;
var color = attr.name1;
var lengthofnodes = (importColorValue.firstChild.childNodes.length);
var nodes = importColorValue.firstChild.childNodes
for(i = 0; i<lengthofnodes - 1; i++){
result = nodes[i].attributes.names;
var colorpallete:MovieClip = color_mc.createEmptyMovieClip("square_mc" + i, color_mc.getNextHighestDepth());
colorpallete.beginFill(result);
colorpallete.moveTo(10, 10);
colorpallete.lineTo(40, 10);
colorpallete.lineTo(40, 40);
colorpallete.lineTo(10, 40);
colorpallete.lineTo(10, 10);
colorpallete.endFill();

colorpallete._x = 10;
colorpallete._y = i * 40;

colorpallete.onPress = function() {
trace(i);
}
}
}


//Now when I am clicking on each movieclip the value of i is tracing as 4 only, for every movieclip.....
How can I get each movieclip different values... means 1 for first movieclip.... 2 for second movieclip etc...


I had tried with storing the values in array and all.. but I don't know it is not working

Here is the screenshot I am attaching how the output look like

View Replies !    View Related
Creating Multiple Movieclips With For Loop Help
How can I dynamically create multiple MovieClips and attach to the stage using a for loop?


for (var j:Number = 0; j<total; j++) {

var my_mc1:MovieClip = trackHolder.attachMovie("DefaultBtn", myHolder.getNextHighestDepth())
};

I need to change the name of my_mc1 to my_mc + j.

How can I do this.

Help appreciated

paulie

View Replies !    View Related
Creating Something Extra Inside The Loop
Hi Guys

I am trying to build a loop that loads pics... my code is already working but now I would like to script some extra code that could draw a frame (square) as picture frame.... I created a function that draws this square for me, but I do not know how to put this function inside the loop.... this is my normal code below that loads my pics and works:

var numberOfPics:Number = 10;
var holder_mc = this.createEmptyMovieClip("holder", 1);
holder_mc._x = 100;
holder_mc._y = 500;
var loadMe:MovieClip;
var startX:Number = 0;
var startY:Number = 0;
var mc_width:Number = 70;
var mc_height:Number = 45;
for(i = 0; i < numberOfPics; i++) {
loadMe = holder_mc.createEmptyMovieClip("gready_" +(i+1), i+1);
loadMe._x = startX;
loadMe._y = startY;
startX += mc_width + 5;
var MCL_listener:Object = new Object();
MCL_listener.onLoadComplete = function(target_mc:MovieClip) {
target_mc.onPress = function():Void {
trace(target_mc._name);
}
}
var MCLoader:MovieClipLoader = new MovieClipLoader();
var picToLoad = "ready_"+(i+1) + ".jpg";
MCLoader.addListener(MCL_listener);
MCLoader.loadClip(picToLoad, loadMe);
}

and this is my function that draws a square:

function drawFrame(color:Number, width:Number, height:Number, x:Number, y:Number):MovieClip {
var depth:Number = this.getNextHighestDepth();
var clip:MovieClip;
clip = this.createEmptyMovieClip("clip" + depth, depth);
clip.lineStyle(1.5, color, 100, true, "none", "square");
clip.lineTo(width, 0);
clip.lineTo(width, height);
clip.lineTo(0, height);
clip.lineTo(0, 0);
clip._x = x;
clip._y = y;
return clip;
}

So now, do you guys know how could I script something inside the loop to call this function to draw the frame on the top of each picture ???

View Replies !    View Related
Creating Something Extra Inside The Loop
Hi Guys

I am trying to build a loop that loads pics... my code is already working but now I would like to script some extra code that could draw a frame (square) as picture frame.... I created a function that draws this square for me, but I do not know how to put this function inside the loop.... this is my normal code below that loads my pics and works:

var numberOfPics:Number = 10;
var holder_mc = this.createEmptyMovieClip("holder", 1);
holder_mc._x = 100;
holder_mc._y = 500;
var loadMe:MovieClip;
var startX:Number = 0;
var startY:Number = 0;
var mc_width:Number = 70;
var mc_height:Number = 45;
for(i = 0; i < numberOfPics; i++) {
loadMe = holder_mc.createEmptyMovieClip("gready_" +(i+1), i+1);
loadMe._x = startX;
loadMe._y = startY;
startX += mc_width + 5;
var MCL_listener:Object = new Object();
MCL_listener.onLoadComplete = function(target_mc:MovieClip) {
target_mc.onPress = function():Void {
trace(target_mc._name);
}
}
var MCLoader:MovieClipLoader = new MovieClipLoader();
var picToLoad = "ready_"+(i+1) + ".jpg";
MCLoader.addListener(MCL_listener);
MCLoader.loadClip(picToLoad, loadMe);
}

and this is my function that draws a square:

function drawFrame(color:Number, width:Number, height:Number, x:Number, y:Number):MovieClip {
var depth:Number = this.getNextHighestDepth();
var clip:MovieClip;
clip = this.createEmptyMovieClip("clip" + depth, depth);
clip.lineStyle(1.5, color, 100, true, "none", "square");
clip.lineTo(width, 0);
clip.lineTo(width, height);
clip.lineTo(0, height);
clip.lineTo(0, 0);
clip._x = x;
clip._y = y;
return clip;
}

So now, do you guys know how could I script something inside the loop to call this function to draw the frame on the top of each picture ???

View Replies !    View Related
Creating Variables With New Names In Loop
What I want to do is to create a new variable appended with a number going thru a loop as so:

Code:
var test = "test";
for(var i=0;i<3;i++)
{
//Create a new variable called test0,test1 and test2 with the value of "test"
var test = [test + i]; //this is wrong
}
//Print out all of the variables test0,test1,test2 which should produce 3 test strings in the output
for(var i=0;i<3;i++)
{
trace(test0);
trace(test1);
trace(test2);
}
Any ideas?

View Replies !    View Related
Creating Variables With Loop In LoadVars
I’m calling back some variables from a SQL database. After jumping through the hoops of getting the ASP page written correctly, I’m running into another issue.


Code:
myData = new LoadVars()
myData.load("transferback.asp")
myData.onLoad = function(succes){
if(succes){
_root.objNum = this.objNum;
} else
trace("Error loading data")
}

Once you get the right formatting from the ASP page, then calling the info and setting it to a root level variable is not really a problem. Where I am having an issue is that I’m not sure of the number of variables I will need to call. I will receive the variable number as objNum, but other variables could be from objType1 to objType5 or more.


Code:
myData = new LoadVars()
myData.load("transferback.asp")
myData.onLoad = function(succes){
if(succes){
_root.objNum = this.objNum;
for(i=1;i<=this.objNum;i++){
_root["objType"+i] = this["objType"+i]
_root["objName"+i] = this["objName"+i]
_root["objWording"+i] = this["objWording"+i]
};
} else
trace("Error loading data")
}
When I try and trace my variables that I’m attempting to build from the loop, I don’t get anything back. Am I wrong here in thinking that I should be able to declare variables this way? Since I can determine the number, I figured I would just use the loop.

Any suggestions welcome. Hope that I made this clear enough…

View Replies !    View Related
Issue With Creating A Text Box From A Loop
I was hoping someone could take a look at this code and maybe help me find out why this isnt working. What I am trying to do is: (NOTE: I have used a few differents scripts and combined them, so the code may not be the greatest).

Pull Data from a PHP file (The PHP file gets it's data from database)
Then run a loop that brings in First Name, Last Name, Jersey Number, and Position
Then before it loops and gets the next player it creates an array that creates 3 text boxes with Full Name, Jersey Number and position
then it loops through the process again untill all of the records have been retreived.

I'm not sure if its because I have a do while loop inside of a for loop inside of a function and an Array. I'm new to Arrays and loops. the issue is it wont display the text boxes.

NOTE: When I trace this, the data is being retrieved.

Thanks for the help












Attach Code

var sender:LoadVars = new LoadVars();
var receiver:LoadVars = new LoadVars();
receiver.onLoad = function(){
for(var i =1;i<=receiver.total;i++){
receiver["dataPacket"+i] = receiver["user_data"+(i)].split("|");
varFirstName = receiver["dataPacket"+i][0];
varLastName = receiver["dataPacket"+i][1];
varJerseyNum = receiver["dataPacket"+i][2];
varPositions = receiver["dataPacket"+i][3];

varFullName = varFirstName + " " + varLastName;//
trace(varFullName);

rosterText = new Array();
rosterText = [varFullName, varJerseyNum, varPositions];

posLR = 10;
posUD = 50;
loopVar = 0;

do {
nameVar = "Testing" + loopVar;
this.createTextField(nameVar, this.getNextHighestDepth(), posLR, posUD, 300, 20);
this[nameVar].text = rosterText[loopVar];
loopVar++
posUD = posUD + 20;

} while (loopVar < rosterText.length);
}
}

sender.sendAndLoad("http://www.freedomsbl.com/displayRoster_HC.php",receiver,"post");


//////////////////////////////////////////////////////
// If I just use the following //
// code, outside of the above //
// function, the text boxes are //
// created fine //
//////////////////////////////////////////////////////

rosterText = new Array();
rosterText = ["Text", "Works", "Fine"];

posLR = 10;
posUD = 50;
loopVar = 0;


do {
nameVar = "Testing" + loopVar;
this.createTextField(nameVar, this.getNextHighestDepth(), posLR, posUD, 300, 20);
this[nameVar].text = rosterText[loopVar];
loopVar++
posUD = posUD + 20;

} while (loopVar < rosterText.length);

View Replies !    View Related
Creating Multiple Function() With A Loop?
ActionScript Code:
for (var i:Number = 0; i<12; i++) {    var myFunction_i:Function = function () {        trace("This is function "+i);    };}myFunction_5();


How do I achieve this?

I'm needing to create identical functions but different 'i' Number Variables so that I can call them as shown when I need to.

Please help ?

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved