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








Dynamic For Loop In Mx2004


I'm using Flash MX2004 and actionscript 2.0

Using the following code I'm able to make the movieclips within an instance of the symbol "pan" on the stage go to various frames named "pan".

function initiate(character1:String):Void {
this.onEnterFrame = function() {
_root[character1].head.head_sub1.gotoAndPlay(character1);
_root[character1].head.feature.gotoAndPlay(character1);
_root[character1].body.gotoAndPlay(character1);
_root[character1].head.ear_r.gotoAndPlay(character1);
_root[character1].head.ear_l.gotoAndPlay(character1);
_root[character1].arm_r.gotoAndPlay(character1);
_root[character1].arm_l.gotoAndPlay(character1);
_root[character1].leg_r.gotoAndPlay(character1);
_root[character1].leg_l.gotoAndPlay(character1);
};
}
initiate("pan");

However I am unable to figure out how to put in multiple parameters at once. I tried the following function but run into the problem that flash is looking on the stage for an instance of "character1" and "character2" when it should be looking for instances of the value of character1 and character2.

function initiate(character1:String, character2:String):Void {
var total_characters:Number = 2;
this.onEnterFrame = function() {
for (i=1; i<=total_characters; i++) {
_root["character"+i].head.head_sub1.gotoAndPlay(["character"+i]);
_root["character"+i].head.feature.gotoAndPlay(["character"+i]);
_root["character"+i].body.gotoAndPlay(["character"+i]);
_root["character"+i].head.ear_r.gotoAndPlay(["character"+i]);
_root["character"+i].head.ear_l.gotoAndPlay(["character"+i]);
_root["character"+i].arm_r.gotoAndPlay(["character"+i]);
_root["character"+i].arm_l.gotoAndPlay(["character"+i]);
_root["character"+i].leg_r.gotoAndPlay(["character"+i]);
_root["character"+i].leg_l.gotoAndPlay(["character"+i]);
}
};
}
initiate("pan", "polar");

Any help would be greatly appreciated,
lkress




FlashKit > Flash Help > Flash ActionScript
Posted on: 09-08-2004, 12:52 AM


View Complete Forum Thread with Replies

Sponsored Links:

[MX2004] Loop An FLV...
hi,
this is my code:

ActionScript Code:
var netConn:NetConnection = new NetConnection();
// Création d'une connection locale streamée
netConn.connect(null);
// Création d'un objet NetStream
statu = 1;
var netStream:NetStream = new NetStream(netConn);
//et définissons une fonction onStatus() pour suivre les différents états
netStream.onStatus = function(infoObject) {
    statu++;
    if (statu == 4) {
        trace("video finie");
    }
    status.text += "Status (NetStream)"+newline;
    status.text += "Level: "+infoObject.level+newline;
    status.text += "Code: "+infoObject.code+newline;
};
// Attache l'avance de la video NetStream à un objet Video :
maVideo.attachVideo(netStream);
// Règlons le temps en sceonde du buffer:
netStream.setBufferTime(2);
/////////////////////////////////////
/////////////////////////////////////
btn1.onRelease = function() {
    netStream.play("laVideoFile.flv");
    // joue la vidéo
};

when the video is finish > Trace is running !!
its good for me!
BUT i can't loop this one
I try to relaunch with Play() but the fla bug.
Thanks
JP

View Replies !    View Related
Conditional Loop Problem (mx2004)
Working on a flash project and having trouble with a conditional loop.
The project is located here:
http://www.joeshields.net/flashlab/c...ies_index.html

My problem is the city name son the large map. I want the current/active city to be animated(this is working) and when i mouse over another city I want the new city to be animated also however if I rolloff dont click the new city the animation on the new city should stop.

I have written the code so that if a click occurs a variable (clicked) is set to 1, so when the rolloff event occurs if clicked = 1 the animation stays and if clicked = 0 the animation finishes. The rol over part isworkign but the rolloff isd not setting clearing the animation on the new city and not setting the clicked variable back to 0.

Am i going aout the is the right way?

Anmy help would be appreciated.

My code

var clicked = 0;

//FUNCTION: City Loader - Remember to set sCurrentCity via big map button
function mapButtonRollover(sCurrentCity):Void {
var sCurrentCityButtonName:String = sCurrentCity+"Button";
sCityPath = _root.mapBig.map[sCurrentCityButtonName];
sCityPath.currentCityText.textColor = 0xFF0000;
sCityPath.dot.gotoAndPlay(2);
sCityPath.butBackground._alpha = 100;

};
function mapButtonRollout(sCurrentCity):Void {
if (clicked != 0) {
sCityPath.currentCityText.textColor = 0xFF0000;
sCityPath.dot.gotoAndPlay(2);
sCityPath.butBackground._alpha = 100;
} else if (clicked != 1) {
sCityPath.currentCityText.textColor = 0x000000;
sCityPath.dot.gotoAndPlay(1);
sCityPath.butBackground._alpha = 0;
trace(clicked);
};
};
function mapButtonClick(sCurrentCity):Void {
sCityPath.currentCityText.textColor = 0xFF0000;
sCityPath.dot.gotoAndPlay(2);
sCityPath.butBackground._alpha = 100;
clicked = 1
trace(clicked);
myData = new LoadVars();
myData.onLoad = function() {
cityName_txt.text = this.cityName;
cityProv_txt.text = this.cityProv;
cityPop_txt.text = this.cityPop;
cityText_txt.text = this.cityText;
};
myData.load(sCurrentCity+".txt");
cityMoviePath = "cities/"+sCurrentCity+"/"+sCurrentCity+".swf";
contentHolder.loadMovie(cityMoviePath);
_root.onEnterFrame = function() {
var infoLoaded, infoTotal;
infoLoaded = contentHolder.getBytesLoaded();
infoTotal = contentHolder.getBytesTotal();
var percentage = (int((infoLoaded/infoTotal)* 100));
infoText.text = percentage+"%";
//loadingBar.bar._width = percentage;
};
};

//Buttons on the big Map
_root.mapBig.map.ShanghaiButton.onRollOver = function() {
mapButtonRollover("Shanghai");
//mapButtonRollout(sCurrentCity);
};
_root.mapBig.map.BeijingButton.onRollOver = function() {
mapButtonRollover("Beijing");
//mapButtonRollout(sCurrentCity);
};
_root.mapBig.map.ChongqingButton.onRollOver = function() {
mapButtonRollover("Chongqing");
//mapButtonRollout(sCurrentCity);
};

//onRollOut functions for big map buttons
_root.mapBig.map.ShanghaiButton.onRollOut = function() {
mapButtonRollout("Shanghai");
};
_root.mapBig.map.BeijingButton.onRollOut = function() {
mapButtonRollout("Beijing");
};
_root.mapBig.map.ChongqingButton.onRollOut = function() {
mapButtonRollout("Chongqing");
};

//onRelease functions for big map buttons
_root.mapBig.map.ShanghaiButton.onRelease = function() {
mapButtonClick("Shanghai");
};
_root.mapBig.map.BeijingButton.onRelease = function() {
mapButtonClick("Beijing");
};
_root.mapBig.map.ChongqingButton.onRelease = function() {
mapButtonClick("Chongqing");
};

FLA:
http://www.joeshields.net/flashlab/c...ities_test.fla
Thanks

View Replies !    View Related
MX2004 For-in Loop Great System Function
I'm working on a nice bit of code utilizing the for-in loop. This should prevent me from manually coding a hundred buttons.

The idea here is to abstract a movie clips name|buton name, pass it to an array then of course perform a search of the arry then perform some action, in this case a system startDrag action function.

I have everything working except(np suprprise here)... execution of the startDrag function(see 3rd line of code in code below reference// conditions).

//goal:
I'm attempting to dynamically determine which button is clicked then execute a startDrag function.

Any help is greatly appreciated.

I can upload a copy of my test file if requested.

iaustin

varray= new Array();

for(var propid in myclip){
if(typeof myclip[propid] == "movieclip"){//is a movie clip
vprops = (myclip[propid]._name);//get the name of clip
trace("vprops by name " +myclip[propid]._name);
farrprops();
}
}

//name put into array and element count
function farrprops(){
arrprops = varray.push(vprops);
trace("push element into an array= " +arrprops);//number of elemnts pushed
trace("name pushed into array =" +varray);
}

//conditions
for(i=0; i<=varray.length; i++){
if(["imc_bttn"+i]==varray[i]){//if name found in arrray
startDrag(["imc_bttn"+i]);//if found in array... drag clip
}
}

View Replies !    View Related
OnRelease On Dynamic Mc [MX2004]
I'm attaching my new xml menu .
The problem is that I can't get the subItems to work with the onRelease function. I've gotten so far, please just help me with this tiny thing and I'm finished!

Many thanks
Kalliban

View Replies !    View Related
OnRelease On Dynamic Mc [MX2004]
I'm attaching my new xml menu .
The problem is that I can't get the subItems to work with the onRelease function. I've gotten so far, please just help me with this tiny thing and I'm finished!

Many thanks
Kalliban

View Replies !    View Related
Is It Possible To Justify Dynamic Text In MX2004?
is it possible to justify dynamic text in MX2004?

View Replies !    View Related
Images In Dynamic Text Box (MX2004)
I searched aroudn the forums and found questions similar to this, but not any answers... But now that a lot more people have MX 2004, I'll try it again.

I have a dynamix text box loading from a txt file on my server. I use it for mainly like a blog-ish news thing, with pictures included. But whenever I have an image load, The text that follows it right after is really screwed up. IT ends up placing itself alongside the image and it finds its way outside of the text box, and then the scroll bar becomes useless. The only way around this that I have found is to just push enter enough times and leave enough lines to have the text go all the way down to where the picture ends, instead of ending up alongside the image..

Is there any other way around this problem? I use the same text file on my html page too, and it just looks really weird when there's a really big space between the bottom of the picture and when the text starts again. Is there another method of loading dynamic text so this would work? I know it's an MX2004 feature, which is what I have. I'd really appreciate any help... Thanks!

View Replies !    View Related
[MX2004] Dynamic Text And Angles
I have a dynamic text box, that is filled using the standard

textBox.text="blah! blah!";

This works ok, but then I have it rotated at an angle say 45% but then the text will not work,

Is there a way to use dynamic text on an angled text box or not, it works on a basic text box?

View Replies !    View Related
MX2004 And Chinese Dynamic Text
Hi all,
im starting to do a project. The Project is a basic flash thingie, but it involves a lot of dynamic texts from external XML files.
one of these languages will be China. Will i be seeing some troubles?

What about embedding the font? As usual, the same text-fields are used in many languages, so embedding something like Arial wont be possible? Should i use "system fonts" or something?

And have any of you seen a Chinese flash site, so i could look at em?

Thank you million times
A

View Replies !    View Related
Any Way To Justify Dynamic Text In MX2004
hello folks,

because FLash mx2004 doesn't support justify property, is there any other way I can make dynamic text maybe look like justified?

any ideas would be greatly appriciated!

View Replies !    View Related
MX2004 And Chinese Dynamic Text
Hi all,
im starting to do a project. The Project is a basic flash thingie, but it involves a lot of dynamic texts from external XML files.
one of these languages will be China. Will i be seeing some troubles?

What about embedding the font? As usual, the same text-fields are used in many languages, so embedding something like Arial wont be possible? Should i use "system fonts" or something?

And have any of you seen a Chinese flash site, so i could look at em?

Thank you million times
A

View Replies !    View Related
Dynamic Pie Chart - Flash Mx2004 Professional
Hi all,
I have a question for you....I'm not able di draw a pie chart dynamically.
I have the Layer1 with a F3DPieChart, 4 input text and a button, I put 4 numer in the 4 inputtext (sum total = 100) and when I press the button I would like to see pie Chart to appear with 4 slices that rappresented my 4 numbers.unfortunately it doesn't happen.
This is the code on layer1:

[quote]
var buttonListener = new Object();

buttonListener.click = function() {
var val;
var dp = new DataProviderClass();
val = _root.t1.text;
dp.addItem ({data:val, color:0xFF0000, label: "1"});
val = _root.t2.text;
dp.addItem ({data:val, color:0x00FF00, label: "2"});
val = _root.t3.text;
dp.addItem ({data:val, color:0x0000FF, label: "3"});
val = _root.t4.text;
dp.addItem ({data:val, color:0xFFFF00, label: "4"});
}
disegno = function(chart){
chart.removeAll();
chart.setDataProvider(dp);
delete dp;
}
_root.button.addEventListener("click", buttonListener);
Any help is apprecciate,
Maryna.

View Replies !    View Related
Dynamic Pie Chart - Flash Mx2004 Professional
Hi all,
I have a question for you....I'm not able di draw a pie chart dynamically.
I have the Layer1 with a F3DPieChart, 4 input text and a button, I put 4 numer in the 4 inputtext (sum total = 100) and when I press the button I would like to see pie Chart to appear with 4 slices that rappresented my 4 numbers.unfortunately it doesn't happen.
This is the code on layer1:

[quote]
var buttonListener = new Object();

buttonListener.click = function() {
var val;
var dp = new DataProviderClass();
val = _root.t1.text;
dp.addItem ({data:val, color:0xFF0000, label: "1"});
val = _root.t2.text;
dp.addItem ({data:val, color:0x00FF00, label: "2"});
val = _root.t3.text;
dp.addItem ({data:val, color:0x0000FF, label: "3"});
val = _root.t4.text;
dp.addItem ({data:val, color:0xFFFF00, label: "4"});
}
disegno = function(chart){
chart.removeAll();
chart.setDataProvider(dp);
delete dp;
}
_root.button.addEventListener("click", buttonListener);
Any help is apprecciate,
Maryna.

View Replies !    View Related
[MX2004] Dynamic Text Field Mask
I have a dynamic text field motion tween that I need masked so you only see part of the motion. The problem is, when I add a mask, the text ins't visible. Are masks not meant to go over dynamic text fields? Is there any way around this?

View Replies !    View Related
Dynamic Menu And GetURL Help Needed (MX2004)
First off I don't have much experience with Flash but I am a fast learner. I hope this is an easy question for one of the Flash gurus here. I am using a template that I found on the web for a webpage with a dynamic menu (dynamic in the sense that the buttons move when the cursor goes over them). I've got it working pretty well but there is one problem I can't figure out. I need one of the buttons to directly jump to an external webpage when mouseclicked on. I have got the getURL working but the dynamic action of the button doesn't work when I added that code (it just becomes a static button). Could you please take a look at my code and let me know how I can fix this? I'm attaching the .fla (it's zipped). Take a look at the Button3IN labeled "Champions". This currently takes you to Google but the button won't slide like the others now. Apparently my attempt to use getURL with the on (release) of that button is breaking the sliding effect of the button.

The other buttons are working fine - they load various swf's into that page, so the menu is consistent. I just have need of a button to kick out of that menu and go directly to another webpage. I hope that's clear - any help or ideas is appreciated.

View Replies !    View Related
Dynamic Pie Chart - Flash Mx2004 Professional
Hi all,
I have a question for you....I'm not able di draw a pie chart dynamically.
I have the Layer1 with a F3DPieChart, 4 input text and a button, I put 4 numer in the 4 inputtext (sum total = 100) and when I press the button I would like to see pie Chart to appear with 4 slices that rappresented my 4 numbers.unfortunately it doesn't happen.
This is the code on layer1:

[quote]
var buttonListener = new Object();

buttonListener.click = function() {
var val;
var dp = new DataProviderClass();
val = _root.t1.text;
dp.addItem ({data:val, color:0xFF0000, label: "1"});
val = _root.t2.text;
dp.addItem ({data:val, color:0x00FF00, label: "2"});
val = _root.t3.text;
dp.addItem ({data:val, color:0x0000FF, label: "3"});
val = _root.t4.text;
dp.addItem ({data:val, color:0xFFFF00, label: "4"});
}
disegno = function(chart){
chart.removeAll();
chart.setDataProvider(dp);
delete dp;
}
_root.button.addEventListener("click", buttonListener);
Any help is apprecciate,
Maryna.

View Replies !    View Related
Dynamic Pie Chart - Flash Mx2004 Professional
Hi all,
I have a question for you....I'm not able di draw a pie chart dynamically.
I have the Layer1 with a F3DPieChart, 4 input text and a button, I put 4 numer in the 4 inputtext (sum total = 100) and when I press the button I would like to see pie Chart to appear with 4 slices that rappresented my 4 numbers.unfortunately it doesn't happen.
This is the code on layer1:

[quote]
var buttonListener = new Object();

buttonListener.click = function() {
var val;
var dp = new DataProviderClass();
val = _root.t1.text;
dp.addItem ({data:val, color:0xFF0000, label: "1"});
val = _root.t2.text;
dp.addItem ({data:val, color:0x00FF00, label: "2"});
val = _root.t3.text;
dp.addItem ({data:val, color:0x0000FF, label: "3"});
val = _root.t4.text;
dp.addItem ({data:val, color:0xFFFF00, label: "4"});
}
disegno = function(chart){
chart.removeAll();
chart.setDataProvider(dp);
delete dp;
}
_root.button.addEventListener("click", buttonListener);
Any help is apprecciate,
Maryna.

View Replies !    View Related
[MX2004] Dynamic Text Field Mask
I have a dynamic text field motion tween that I need masked so you only see part of the motion. The problem is, when I add a mask, the text ins't visible. Are masks not meant to go over dynamic text fields? Is there any way around this?

View Replies !    View Related
Attach Dynamic Movieclip To Scrollpane MX2004
Hi,
How do you attach multiple movie clip to a scrollpane.
I did the following but it doesn't seem to work

1. create an empty movieclip
2. attached multiple movie clip from the library into the previously created empty movie clip
3. set the contenPath of the scrollpane to pint to the empty movie clip (from step 1)

OUTPUT.
movie clip will show up outside the scrollpane.

Did I do smething wrong ?

Thanks:-)

View Replies !    View Related
Trouble With Flash Mx2004 And Dynamic Text Fields>>someone Must Have Come Across This
There must be someone out there who can help me, im not new to flash or to actionscript but ive tried about three different ways to load text into a dymanic text box and none of them work, need someone with more experience than me to tell me what the hell is goin on!?
Basically i have a single flash file which is the main body of the website im building, in the center of this i have a movie clip with a black border that loads all the different sub sections (small flash files themselves) of the site when user clicks on relevant buttons eg. 'about me', 'showreel' and so on. everything works fine so far.
However, I have a dynamic text field set up within these mini flash files which wont load when the whole thing is played. Thing is when i preview each sub flash file eg 'aboutme.swf' the text loads fine but when that whole flash file is loaded into the bigger parent site the animation still works but text doesnt! so frustrating! ive seen people on here with similar problems but no one seems able to give answer? think it may have something to do with referencing but i need code if this is case.
ive currently got main site file of untitled7c.swf which has a movie clip with instance name "main" within it, this movie clip is coded to load all the different flash mini sections. within the flash mini sites i have code like this that loads the text>>
loadVariablesNum('intro.txt', 0); the dynamic text box has instance name of showreel and variable name showreel, and text file has the appropriate variable to match so i know thats right (plus it works on its own) should the code be more like this? >>
loadVariablesNum('intro.txt', _root.level0.Main.scrollwindow);
therefore drilling down to where the dynamic box is located? by the way that peice of code doesnt work so it must be wrong somehow. and if that peice of code is more like what it should be then should it be in the script pane of the sub flash section ie. aboutme.swf or on the root timeline script pane?
PLEASE SOMEONE HELP IM GOING INSANE WITH THIS!!!!!
thanks to anyone who takes the time to help,
ade30004@port.ac.uk
www.dink.org.uk/index5.htm (site in question)

View Replies !    View Related
Difficulty Transforming Dynamic Text Fields In MX2004
I know its gonna sound very amateurish but its frustrating. I know, at least I am pretty sure you can distort dynamic text fields using the free transform tool,just as you can static fields, but whenever I distort or rotate the dynamic fild in the slightest on my new site the text disappears. Can anyone tell me why and/or tell me if I how to distort these fields. I am looking to create a laying on the table (perspective) effect. Thanks alot for any help

View Replies !    View Related
F MX2004, Problem Loading Vars Into Dynamic Text
hello, i will give a brief description of the structure of my clips.

i have an swf called movie1, on the main stage of movie1 i have a mc that is named xpos, inside xpos i have a dynamic text box and it's value is asigned to the Var=clipX.

to get the value of clipX i used this code in the actions of xpos like this:


Code:
onClipEvent(enterFrame) {
clipX = (_root.object._x);
}
everything is fine and it works when i play movie1

but when i use movie2 to load movie1


Code:
_root.content.loadMovie("movie1.swf");
the mc xpos appears to be "undefined"

i know its because when movie1 is loaded into movie2 the path used to define the Var clipX has changed, but i already tried this


Code:
onClipEvent(enterFrame) {
clipX = (_root.content.movie1.object._x);
}
and that is supposed to Not work on movie1 but is supposedly supposed to work for movie2. But my supposed code is not working either way. So, I am totally lost right now.

this.n.needs.help.and._hints =/ "true"

Thanks in Advance.

View Replies !    View Related
[MX2004] How To Call Dynamic Input Text From Class
Hello all,

I have a problem with my actionscript, and i hope some of you can give me a push in the right direction.

In the GameBox class, I make several instances of the Movieclip/Class "Module". These Module movieclips have a dynamic input text named "moduleNaam".

The way how i make instances of Module:

Code:
class GameBox extends MovieClip
{
...

function GameBox() {
....

// Place the modules
attachMovie("Module", 'Module1, 2001, {id: 1, naam: "icom4"});
attachMovie("Module", 'Module2', 2002, {id: 2, naam: "ibk2"});
attachMovie("Module", 'Module3', 2003, {id: 3, naam: "icom4"});
attachMovie("Module", 'Module4', 2004, {id: 4, naam: "ibk2"});
....
Is this the right way to do such things?

Then, in the Module.as class


Code:
class Module extends MovieClip {
...
var id : Number;
var naam : String;

function Module() {
....
_root.gameBoxInst.Module1.moduleNaam.text = naam;
}
But to call the moduleNaam via _root is not very convenient, and how can I target this very module, ipv only Module1? Like: this or "Module"+id or something?

View Replies !    View Related
F MX2004, Problem Loading Vars Into Dynamic Text
hello, i will give a brief description of the structure of my clips.

i have an swf called movie1, on the main stage of movie1 i have a mc that is named xpos, inside xpos i have a dynamic text box and it's value is asigned to the Var=clipX.

to get the value of clipX i used this code in the actions of xpos like this:


Code:
onClipEvent(enterFrame) {
clipX = (_root.object._x);
}
everything is fine and it works when i play movie1

but when i use movie2 to load movie1


Code:
_root.content.loadMovie("movie1.swf");
the mc xpos appears to be "undefined"

i know its because when movie1 is loaded into movie2 the path used to define the Var clipX has changed, but i already tried this


Code:
onClipEvent(enterFrame) {
clipX = (_root.content.movie1.object._x);
}
and that is supposed to Not work on movie1 but is supposedly supposed to work for movie2. But my supposed code is not working either way. So, I am totally lost right now.

this.n.needs.help.and._hints =/ "true"

Thanks in Advance.

View Replies !    View Related
[mx2004] Text Area Component Vs. Dynamic Text Box
Hi I have made this which works exactly how I want it to using a text area component

http://www.goslinganimation.com/wall/test2_b.swf

Now I want the same thing but using a dynamic text box instead.

This is the code I have used

Code:
var fontType = "font1";

messageBox.text = "This is a message test. Blah blah blah";

// define the font styles
var styleObj = new mx.styles.CSSStyleDeclaration();
styleObj.styleName = "styleOne";
_global.styles.styleOne = styleObj;
styleObj.setStyle("fontFamily", "space cowboy.");
styleObj.setStyle("fontSize", 20);
styleObj.setStyle("fontWeight", "bold");
styleObj.setStyle("themeColor", "haloOrange");

var styleObj = new mx.styles.CSSStyleDeclaration();
styleObj.styleName = "styleTwo";
_global.styles.styleTwo = styleObj;
styleObj.setStyle("fontFamily", "Jennifer's Hand Writing");
styleObj.setStyle("fontSize", 16);
styleObj.setStyle("fontWeight", "bold");
styleObj.setStyle("themeColor", "haloOrange");

var styleObj = new mx.styles.CSSStyleDeclaration();
styleObj.styleName = "styleThree";
_global.styles.styleThree = styleObj;
styleObj.setStyle("fontFamily", "delarge marker pen");
styleObj.setStyle("fontSize", 15);
styleObj.setStyle("fontWeight", "bold");
styleObj.setStyle("themeColor", "haloOrange");

//------------------------------------------------

if (fontType == "font1") {
messageBox.setStyle("styleName", "styleOne");
} else if (fontType == "font2") {
messageBox.setStyle("styleName", "styleTwo");
} else {
messageBox.setStyle("styleName", "styleThree");
}
any ideas?

View Replies !    View Related
Dynamic For In Loop?
I need to set a dynamic value as part of a for..in loop.
Flash is hissing at me when i do the stuff below


Code:
function getServiceCode_Result(sct_availability) {
//trace("serviceCode"+eval(serviceCode))
for (eval(service_code) in sct_availability) { //< this doesn't work
name = sct_availability[eval(service_code)].name;
price = sct_availability[eval(service_code)].date;
myDate = sct_availability[eval(service_code)].price;
lable = name + " " + price + " " + myDate
sendToTree(lable);
}
}

any ideas?

View Replies !    View Related
Loop And Dynamic Txt Help
I have a dynamic txt box loaded into a flash page. when i click a button on the side bar it loads another external txt into the dynamic txt box. what i want to know is how is it possible to format the txt file? Is it possible to load an html file? or are there special formating tags that i can use?

I also had tried to implement the scrollbar into the dynamic txt field but the way i have done things means that the loadtext command screws things up. So i resulted to making two more buttons and using the following code to make the text scroll up and down when the user clicks them.

on (rollOver) { textField.scroll=textFieldscroll + 1
}

Now this works fine but i want to loop this command so that if the mouse is still rolled over then the text continues to scroll and when it is rolled off the button it stops scrolling the text. Ive tried using for, if and do while commands but i cant seem to get it to work without it just jumping to the end of the page or creating an infinit loop that causes a crash.

View Replies !    View Related
Dynamic Loop
Code:
while(count<numOfPics)
{
lastClip = dupMovName+(count-1);
thisClip = dupMovName+count;

position = Math.round(Number(lastClip:_x)+picSize);

this[thisClip]._x = Number(lastClip:_x);

count++;
}
What this code is supposed to do is set the position of images with a name, which is composed of dupMovName (is set as: "clipart") and the according number (so I have clipart1,clipart2...and so on), to the position of clipart1+100 (=picSize).
The number of images is variable so I need some sort of loop to cover al the images, but (I am a beginner) I don't know the syntax do get this done.
I tried it a few hundred ways around, but no luck yet...

Suggestions anyone?

View Replies !    View Related
Dynamic XML Loop
Flash Masters,

I hope you can help me out. I am trying to dynamically add text fields based on the XML length. I can get the loop to work just fine with addChild based on the lenght but when I add in the XML date I get an error. Error #1010: A term is undefined and has no properties.

Ive tracked it down to this line of code

this["hempDate_txt"+i].text = list[i].hempDate

Any ideas of how to make this work?
EDIT
Thank you for all the help But I figured I needed to just change it too
tField1.text = list[i].hempDate;

Thanks


Chad

View Replies !    View Related
Dynamic Loop
Hello every one I am Trying to animate a movie clip from left to right, and I need the movie clip to detect when it has meet the half way point and then duplicate itself to the end of the movie clip so that i receive a continues loop without having to use a massive amount of frames.

if any one could help with this it will be very much appreciated.

View Replies !    View Related
Dynamic While Loop
Hey

I am creating an internal search engine for my website

I need to display the results and want a button for each result. Now i have my button in the library and i know how to attach it using attachMovieClip. I am struggeling to get it to load in multiple buttons.

Now what i have done so far is to create a emptyMovieClip
Then set its x and y Values
Then i start my while loop and create another empy movielip in that and then attach the button inside that clip. The reason i create another empty clip is so that i can movie that clip to the next y value.
Could someone please have a look at my code and give me a few pointers?


PHP Code:





// Start of doSearch Function
function doSearch(search) {
    count = search.length;
    SearchResultsDepth = 3000;
    moreClipDepth = 1999;
    moreClipButtonDepth = 1500;
    i = 0;
    j = 0;
    searchXvalue = 110;
    searchYvalue = 140;
    // Create Empty Clip For Buttons
    _root.createEmptyMovieClip("more", 2000);
    _root.more._y = 150;
    _root.more._x = 80;
    moreClipX = 80;
    moreClipY = 150;
    while (count>=1) {
        // createTextField (instanceName,depth,x,y,width,height)
        createTextField("searchResultsTitles", SearchResultsDepth, searchXvalue, searchYvalue, 300, 25);
        _root.searchResultsTitles.text = search[i];
        searchResultsTitles.setTextFormat(homepageArticlesTitles);
        searchResultsTitles.selectable = false;
        // attach the buttons
        moreClip = "Clip"+j;
        MoreButton = "Button"+j;
        _root.more.createEmptyMovieClip(moreClip, moreClipDepth);
        _root.more.moreClip._y = moreClipY;
        _root.more.moreClip.attachMovie("OverviewButton", MoreButton, moreClipButtonDepth);
        // change the function values(text Related)
        count--;
        i++;
        j++;
        SearchResultsDepth--;
        searchYvalue = searchYvalue+25;
        // change the function values(Button Related)
        moreClipDepth--;
        moreClipButtonDepth--;
        moreClipY = moreClipY+25;
    }
}
// End of doSearch Function 







This does not actually create any button. I have a feeling that it has to do with the moreClip variable.

Any help or tutorials would be appreciated

Hanu

View Replies !    View Related
Dynamic Motion Loop
anybody knows how to loop a scrolling symbol on the scene,
i have this code on my symbol.


onClipEvent (load) {
this._x = 50;
}
onClipEvent (enterFrame) {
this._x = this._x+5;
}


but i cannot loop it.

View Replies !    View Related
For I In Loop And Dynamic Variables
hi,
I can create dynamicly variables but how can I ge the values?
my trace action doesnt give me the values
has somebody an idea?

// <code>

var cnt = 0;
for (var i in nav_mc) {
nav_mc[i]["movie"+cnt] = cnt;
nav_mc[i].onRelease = function() {
//trace(this["movie"+cnt])
};
cnt++;
}
// <endCode>


//----------------------------------------------------
// OUTPUT WINDOW:
//----------------------------------------------------
Variable _level0.nav_mc.myClip1_mc.movie1 = 1
Variable _level0.nav_mc.myClip1_mc.onRelease = [Funktion 'onRelease']
Movieclip: Ziel="_level0.nav_mc.myClip2_mc"
Variable _level0.nav_mc.myClip2_mc.movie0 = 0
Variable _level0.nav_mc.myClip2_mc.onRelease = [Funktion 'onRelease']

View Replies !    View Related
Loop A Dynamic Loaded Mp3
can you? cause it won't work for me..

View Replies !    View Related
How Can I Loop Dynamic Loaded Mp3?
hello friends

i have loaded external mp3 with folloing code


Code:
loop1 = new Sound();
loop1.loadSound("mp3/track1.mp3");
but dont know how to loop

i want to load this mp3 file in start

so when movie is start to play.. it automatically play and yes in loop

please help me

thanks

View Replies !    View Related
Dynamic Loop Loader
Hi, I'm working on some sort of dynamic loop loader.

The idea is that you have several loops who can follow up each other.
The first loop is played streaming, when started playing, loop 2 should start loading (invisible).

loop 1 repeats till loop 2 is fully loaded, at the end of the last loop 1 it should be followed by the loaded loop 2

now that loop 2 has started to play, it should start to load loop 3(invisible)

When loading loop 3 has finished and an instance of playing loop 2 has came to a loop-point, loop 3 should start playing.

....
the last loop should be follewed again by loop 1, loop2, loop 3, loop 4 ... loop1 (because all loops are preloaded at that time)

the basic idea after it is that the music constantly evolves, while downloadtime is balanced ...

This is the code I have now;it has the basic system (it works) !
The only problem is that all loops start preloading (sx.loadSound ) at the same point


In frame 1 i have

Code:
s1 = new Sound();
s2 = new Sound();
s3 = new Sound();
now I use this code in frame 2

Code:
s3.onSoundComplete = function() {
s1.start(0, 1); // loop 3 done ? -> start over @ loop 1
};
s2.onSoundComplete = function() {
if (s3.getBytesLoaded()>=s3.getBytesTotal()) {
s3.start(0, 1); // if s3 loaded; start playing
} else {
s2.start(0, 1); // else repeat s2 till s3 has been loaded
}
};
s1.onSoundComplete = function() {
if (s2.getBytesLoaded()>=s2.getBytesTotal()) {
s2.start(0, 1); // if s2 loaded; start playing
} else {
s1.start(0, 1); // else repeat s1 till s2 has been loaded
}
};
s1.loadSound("./dropper.mp3",true);
s2.loadSound("./dropper2.mp3");
s3.loadSound("./dropper3.mp3");
Ive tried already this option

Code:
s1.onSoundComplete = function() {
s2.loadSound("./dropper2.mp3");
if (s2.getBytesLoaded()>=s2.getBytesTotal()) {
s2.start(0, 1);
} else {
s1.start(0, 1);
}
};
but unsuccesfull.
I shoud be able to detect if s2.loadSound already has been called

Sorry for my bad english, hope you understand me.

thx in advantage

View Replies !    View Related
Dynamic Buttons Loop
I need 150 buttons, each loading a different jpg. So I'm trying to use duplicate movie to create the buttons and add also add the script. The code below creates the buttons and spaces them fine...


Code:
while (i<=150) {
duplicateMovieClip("button_mc", "button_mc"+i, _root.getNextHighestDepth());
_root["button_mc"+i].onRollOver = function(){
_root["button_mc"+i].useHandCursor=true;
}

_root["button_mc"+i]._x = baseX + mcW*((i-1)%ipr);
_root["button_mc"+i]._y = baseY + mcH*int((i-1)/ipr);
i++
}
but when i add this bit of code (after the first function):

Code:
_root["button_mc"+i].onPress = function(){
_root.sofaClip.armL.armL_btn.onPress = function() {
img_mcl.loadClip("images/"+i+".jpg", _root.sofaClip.armL.container);
}
}
when I test the movie, any button i press i get a message saying:
Error opening URL "file:///images/151.jpg"

I think I am adding the code in the wrong place i.e. after the variable i is 150, meaning that this part: "images/"+i+".jpg" brings back 151.jpg

Any suggestions would be really appreciated.
Thanks.

View Replies !    View Related
Loop For Dynamic TextFields
Hi,

Trying to create text fields... 10 rows, 4 in each row.

This doesn't throw an error...

for(var i:Number=0; i<contentArray.length; i++){
for(var j:Number=1; j<5; j++){ this.createTextField("textField"+i+j,i+j,i*30,j*30 ,100,30);
}
}


But Debug > Objects shows that it only creates 4 across on the last j loop:

Target="_level0.textField01"
Target="_level0.textField11"
Target="_level0.textField21"
Target="_level0.textField31"
Target="_level0.textField41"
Target="_level0.textField51"
Target="_level0.textField61"
Target="_level0.textField71"
Target="_level0.textField81"
Target="_level0.textField91"
Target="_level0.textField92"
Target="_level0.textField93"
Target="_level0.textField94"


Stupidity... or ???

thx.

View Replies !    View Related
Dynamic Loop Xml Attributes
Hi there,

does anyone maybe knows if there is a possibillity to dynamicly loop threw xml node attributes?

so i can get out the amount of the node attributes (like length of an array) the attribute names and the attribute values? i tried several things but cant find a way...

if this isnt possible, is there maybe an easy way to convert all node attributes in an array?

thanks alot!

View Replies !    View Related
Flash Dynamic Loop Help
Hey all,

i've currently got php looping out a reply to flash in a query string form like below,

amountOfVars=3&var1=alex&var2=welcome&var3=helloag ain

all is fine in the php stage, but when i get to flash and try to get flash to loop the vars back out i run into a problem, e.g.


ActionScript Code:
var replyData:URLVariables = new URLVariables(urlLoader.data);
var i:Number = 0;
           
while(i < replyData.amountOfVars) {
    comboBox.addItem({label:replyData.var1});
    i++;
}

As seen above, this code loops out the same var1, 3 times, what i cant work out is how to get the loop to change the replyData.var, to a var2 and var3

Everything i try seems to reply with NaN, nothing at all, or undefined.

Sorry if this is a little confusing :P

Thanks in advanced,
alex

View Replies !    View Related
Dynamic Button In For Loop? Help Please
Hello,

I have 10 movieclips that I want to assign this button function to:

vest01_mc.onRollOver = function () {

TweenLite.to(this, 1, { _brightness:40, ease:Regular.easeOut, delay:0});
}

Instead of writing functions for all 10 clips I thought I could use a For Loop (code pasted below) but it doesn't seem to work. I think it's because "vestMc" is a string not an object. Is there a way to convert a string to an object or is there some other way to write this code and achieve the same results?

for (i=1;i<11;i++){

vestMc = "vest" + i + "_mc";

vestMc.onRollOver = function () {

TweenLite.to(this, 1, { _brightness:40, ease:Regular.easeOut, delay:0});
}

vestMc.onRelease = function () {

vestNum = 1;
bgFade("vestDetail");
}

vestMc.onRollOut = function () {

changeOptionColor(this, outColor);

}

}

thanks so much!

View Replies !    View Related
Dynamic Vars In For Loop
Hi, I have created a movieclip. This movieclip will have 5 child Sprite's, which will contain an image pulled from xml.

I want to create a for loop to create those 5 Sprite's, add the appropriate image into each one (i.e., img[0] into sprite[0]) and then add each sprite to the movieclip.

Here is how I'm failing to do it...


ActionScript Code:
//    var xmlImgHolder_1:Sprite = new Sprite();
//    var xmlImgHolder_2:Sprite = new Sprite();
//    var xmlImgHolder_3:Sprite = new Sprite();
//    var xmlImgHolder_4:Sprite = new Sprite();
//    var xmlImgHolder_5:Sprite = new Sprite();
       
        for (var i:uint = 0; i < xmlData.length; i++){
            var xmlImgHolder_[i * 1]:Sprite = new Sprite();
        }

is there another way?

OR... perhaps can I create 1 Sprite, instantiate it and call it by name?

View Replies !    View Related
Using Dynamic Variable Name In A Loop... How?
i am totally unsure of what i am doing wrong and whether this is even possible.
how do i loop the NAME of the variable? (not the contents)

i have 10 variables in movie clip 'myMovie' called pos1,pos2... up to pos10.
i want to loop those names in a 'for' script adding 'newVariable' to each.
something like this:

for (var a = 1; a<11; a++) {
"myMovie.pos"+a = newVariable;
}

basically i want the variable name to loop through myMove.pos + the numbers 1 -10 and in each of these variables will be "newVariable"

i keep trying to use either eval or whatever and everything seems to throw an error saying that a variable or property must be used to the left of the = sign.

anyways hope this makes sense
any help.... please....

View Replies !    View Related
Dynamic Function In For Loop...Possible?
Just like it says. I've made a Biology Dictionary that uses an array to access the necessary information to display. From there I made a movieclip which contains more movieclips that act as buttons for displaying the information.

Now from there I realized that I would have to do something like

ActionScript Code:
_root.scroller.scroll0_mc.onRelease=new function(){
_root.descrip_txt.text=_root.descriptions[0];
for each and every buttons code. Now I could do that, but I don't want to have to write that same code again and again with only minor alterations (Yes I know of Ctrl+C and Ctrl+V)

So is there any way I could automate that bit of code via a for loop?

Thanks in advance.

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
Loop Over Dynamic Text Box?
Hi Guys:
How do I loop some text over a dynamic text box.

I have a dynamic text box called (dyntext). I have a button below that Says "Click Here" or something to that effect.

Now, when I Click on the button, I have some code like

var i
for(int i=0;i<25;i++) {
dyn.text="this is a test";
}

but no dice. it only writes it once. not the 25 times like I want. it works in trace("message") but why not in a dynamic text box.

thanks guys.

jeyyu.

View Replies !    View Related
Dynamic _y Spacing In A Loop
is it possible to have a dynamic _y spacing between movieclips of different heights attached using a loop?

View Replies !    View Related
Dynamic Sound Loop?
Hi Guys

So I have a dynamic sound loaded into my scene.

mySound = new Sound();
mySound.loadSound("music.mp3",true);

How do I make the sound loop? once it's there.

Many thanks

Bana

View Replies !    View Related
[flash 4] While Loop And Dynamic Variables
Hi...

I've got a problem with some variables I use in my flash 4 (yes 4) movie.

I load a php script which returns the following: w1=hello&w2=world etc...it can go up to w250 (there is a variance)

These variables need to be used in the movie later on.
I do a while loop with the following code:

Loop While (a<=9)
Set Variable: "b" = a+1
Set Variable: "rw" = "word"&b
Set Variable: "ww" = "w"&b
Duplicate Movie Clip ("/word", rw, b)
Set Property (rw, X Position) = "10"
Set Variable: "y" = 33+(18*b)
Set Property (rw, Y Position) = y
Set Variable: "a" = a+1
Set Variable: rw&":n" = ww
End Loop

The loop goes ok but I have one problem with the line:

Set Variable: "ww" = "w"&b

when I enter

Set Variable: "ww" = w3

it shows the right content (out of variable w3, returned from the phpscript) but I can't seem to figure out the way to loop through it the way I want (as above)

Any ideas?

thx

View Replies !    View Related
Setting RollOver Fns On Dynamic MCs, Within A Loop
Something is amiss.

I have duplicated MCs, using loaded data and a loop. When the "spot" in the MC is rolled over, two text boxes appear. They vanish on rollout. Well, that's the idea.

It works if I do the following script minus the loop... with just say, i=1. But when I loop it, the "spots" in the different MCs don't make visible their own text boxes... they all trigger the same one: the last one. (Actually, they attempt to trigger one after the last one, if there were another. I had to mess around a lot before I figured that much out. That's why "(i-1)" is there instead of "i", so I could see what was happening.)

I assume I can't set this up this way then. How would I achieve the same effect? Thanks for any ideas...


Code:
varReceiver = new LoadVars();
varReceiver.load("fetchmapdata.php");
varReceiver.onLoad = function(){
var numspotsVar = this.numspots;
for (var i = 0; i < numspotsVar; i++) {
duplicateMovieClip("textbox", "textbox"+i, i);
_root["textbox"+i]._x = this["xx"+i];
_root["textbox"+i]._y = this["yy"+i];
_root["textbox"+i].DyText.text = this["textVar"+i];
_root["textbox"+i].DateText.text = this["dateVar"+i];
_root["textbox"+i].DyText.autoSize = "center";
_root["textbox"+i].DyText.background = true;
_root["textbox"+i].DyText.backgroundColor = 0xaaccdd;
_root["textbox"+i].DyText.wordWrap = true;
_root["textbox"+i].DyText._visible = false;
_root["textbox"+i].DateText.background = true;
_root["textbox"+i].DateText.backgroundColor = 0xaaccdd;
_root["textbox"+i].DateText._visible = false;
_root["textbox"+i].spot.onRollOver = function () {
_root["textbox"+(i-1)].DyText._visible = true;
_root["textbox"+(i-1)].DateText._visible = true;
}
_root["textbox"+i].spot.onRollOut = function () {
_root["textbox"+(i-1)].DyText._visible = false;
_root["textbox"+(i-1)].DateText._visible = false;
}
}
}

View Replies !    View Related
Dynamic Sound: Loop Control
hi,

i'm trying to loop some seperate music tracks and mute the sounds individually by buttons- a bit like a mixer or sequencer. i'm loading them from the library using attachsound and looping them using onsoundcomplete which is fine if the loops are all exactly the same length but what about if i want to sync a sound that is not as long as the whole loop to only play at the beginning of the loop? eg. a cymbal crash at the beginning of a drum beat.

i've tried to contain all the sounds on one soundcomplete command eg...

drum.onSoundComplete = function() {

drum.start();
bass.start();
synth.start();

}

which works fine to keep the loops together but now all the volumes are set to zero when i press the button controlling the drum track. i tried to add a variable which was flicked to true onSoundComplete and when the variable was true trigger sounds to all start again. but instead they stopped looping altogether.

cheers,

dave.

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