Using Variables In Path
Does actionscript not allow variables to be used in a path? Here is my problem:
clipName= _root.tileArray[row][column];
boardPieces.clipName.attachMovie(movieType, "clip2",boardPieces.clipName.getNextHighestDepth() , {_x: -36.6, _y: -11.2});
The problem is with using 'clipName' in the path. It doesn't seem to recognize it as a variable. How can I use a variable in this way?
FlashKit > Flash Help > Flash ActionScript
Posted on: 05-01-2005, 05:22 PM
View Complete Forum Thread with Replies
Sponsored Links:
Variables Path?
i'm trying to set the value of a variable that i'm loading, this is the AS i have attached to the button now.
on (release) {
_level2.targetx = 800;
loadMovieNum ("barspics.swf", 2);
}
it does nothing. i've tried several variations, still nothing. i'm trying to set teh variable from my home movie to level 2. I can't do it from within the movie clip because i already have it set for a different event.
thanks
e
View Replies !
View Related
Path With Variables In It...?
hi there...
im trying to target a variable using a dynamic path
this is my statement:
(which doesn't work)
_root[currentname]mainfolderlabel = _root[currentname];
currentname is a variable that changes in a loop.
How do i re-write this to work?
Cheers
Danny
View Replies !
View Related
Using Variables In Path
I would like to replace the paths in the following based upon variables:
switch (_global.ticksLeft) {
case 3 :
_root.MainScoreboard_mc.gl_11.gotoAndStop("On");
break;
case 2 :
_root.MainScoreboard_mc.gl_12.gotoAndStop("On");break;
case 1 :
_root.MainScoreboard_mc.gl_13.gotoAndStop("On")break;
}
Like this:
_global.goalLightPath = _root.MainScoreboard_mc.gl_12;
switch (_global.ticksLeft) {
case 3 :
_global.goalLightPath.gotoAndStop("On");
break;
case 2 :
_global.goalLightPath.gotoAndStop("On");
break;
case 1 :
_global.goalLightPath.gotoAndStop("On")
break;
}
Easy enough...but I'm having problems with the next step which is to replace the gl_11, gl_12 and gl_13 instances with a variable and combining the result to one path. There are 4 levels, 1 through 4 and each of these instances represent a light displaying what level you are on. I want to replace the first number in each instance as this represents the level.
i.e. - gl_11 becomes gl_x1, gl_12 becomes gl_x2 etc...
so if it is level one:
_global.levelNum = 1;
gl_11, gl_12, gl_13
if it is level 2 I would set the var:
_global.levelNum = 2;
gl_21, gl_22, gl_23
and so on...
I am unable to develop the correct code to do so - any help would be appreciated. I know I'm missing something
Basicly - I need this:
_global.goalLightPath = _root.MainScoreboard_mc.gl_x2;
where x can be dynamic based upon a previously set variable
Any and all help appreciated.
View Replies !
View Related
Variables In Path
Can anyone tell me why if this works
this.select_info.textInfo.current_txt.text = this_lv.definition
why these don't work
scr_name = "select_info";
this.scr_name.textInfo.current_txt.text = this_lv.definition
this[scr_name].textInfo.current_txt.text = this_lv.definition
I'd appreciate some help here so that I can get into somemore trouble later.
Thanks in advance...
View Replies !
View Related
Two Variables In Mc Path... Tried Everything
Hi... searched also through forum without luck...
Wrote this function:
Code:
MovieClip.prototype.remove_tooltip = function(tooltip_number:Number, tooltip_id:Number, source_level:MovieClip) {
source_level.tooltip_onStage3.alphaTo(0, 0.2, "linear");
clearInterval(source_level.tooltip_onStage_id3);
};
Basically, in "source_level" variable I pass a MC path to the function, ie: _level0.panel .
The problem is the number after _onStage (in the above case "3") should be also a variable (tooltip_number).
Same goes for the second statement: where the number "3" should be swapped with "tooltip_number" variable.
Like:
source_level.tooltip_onStage ??? tooltip_number ???.alphaTo(0,0.2,"linear")...
clearInterval(source_level.tooltip_onStage_id ??? tooltip_number ??? );
I've tried everything... square brackets,quotes,double quotes,eval... I'm going mad...
How can I swap the fixed number with my dynamic variable "tooltip_number" ?
Please help.
Thanks.
View Replies !
View Related
Reference Path Using Variables
Hello,
i have a script that creates a text field and sets a text field.
the since the text field is dyanmically generated i need to reference the path using variables e.g.
_root.textfieldContainer.mytext.text = _root.stringArray.shift();
i neeed to reference the "mytext" as i will be generating mytext1, mytext2, etc..
how can i do this
View Replies !
View Related
Using Variables In A Target Path?
how do I put a variable into a target path?
for example
_root.myMovie._x, but I want to do this to different myMovie files, eg.
myMovie_1,
myMovie_2
etc, and I have a variable var s = 1
eg. the number that changes for each movie. Is it then
_root.myMovie+s._x?
or what???
thanks, and I hope this is not a stupid question.
View Replies !
View Related
How To Get Page Name And Path As Variables
I've created a movie that will load another movie clip depending on the path and name of the page that is currently loaded. However I don't know php or how to get the path/pagename returned to flash as a variable, which would then correspond with the movie name to load. The path variables would need to be dynamic for lower levels of the site structure.
So for example:
mysite.com/photos/page1.html
would result in
path1=photos&pagename=page1
and
mysite.com/photos/group1/page1.html
would result in
path1=photos&path2=group1&pagename=page1
Having worked with a php programmer on a mini-flash site that was driven by php and mysql, I figured this was the way to go. Is there a simpler solution? Not sure where to begin.
Thanks!
View Replies !
View Related
Attaching Mc's To Other Mc's Using Path Variables
Hi all,
I need to attach a mc or textfield to a parent mc using a path variable (backgroundBoxPath in this case), and manipulate the attached mc with reference to its parents parameters.
However, although trace reports the values of the parameters that you would expect, the results on screen seem to show something completely different, bearing no relation to the figures reported in trace.
Can anyone tell me why this doesn't work as I expect it to?
code: _root.createEmptyMovieClip ("holdingLayer_mc", 1);
_root.holdingLayer_mc.attachMovie ("square1", "backgroundBox_mc", 1);
backgroundBoxPath = _root.holdingLayer_mc.backgroundBox_mc;
backgroundBoxPath._x = backgroundBoxPath._y = 20;
backgroundBoxPath._width = backgroundBoxPath._height = 20;
backgroundBoxPath.attachMovie ("square2", "foregroundSquare_mc", 1);
insetBoxX = backgroundBoxPath._x;
insetBoxY = backgroundBoxPath._y;
insetBoxWidth = backgroundBoxPath._width - 2;
insetBoxHeight = backgroundBoxPath._height - 2;
backgroundBoxPath.foregroundSquare_mc._x = insetBoxX;
backgroundBoxPath.foregroundSquare_mc._y = insetBoxY;
backgroundBoxPath.foregroundSquare_mc._width = insetBoxWidth;
backgroundBoxPath.foregroundSquare_mc._height = insetBoxHeight;
trace ("backgroundBoxPath.foregroundSquare_mc._x = "+backgroundBoxPath.foregroundSquare_mc._x);
trace ("backgroundBoxPath.foregroundSquare_mc._y = "+backgroundBoxPath.foregroundSquare_mc._y);
trace ("backgroundBoxPath.foregroundSquare_mc._width = "+backgroundBoxPath.foregroundSquare_mc._width );
trace ("backgroundBoxPath.foregroundSquare_mc._height = "+backgroundBoxPath.foregroundSquare_mc._heigh t);
Bill
View Replies !
View Related
Tracking Variables Path
Hi all,
Is there away to track where a variable exists via trace or any other means. If i have created a variable that is in a movie that is in another movie and so on and so on can i trace it's path in relation to the _root?
Cheers
View Replies !
View Related
Path Variables Help/advice
Im building an interface and I have a path question.
I have These movies nested
Scroll Clip --instance name :ScrollShell
Mask Clip --instance name :Scroll
Text Clip --instance name :ScrollPanel
Product_Box --instance name :Product1
Prod1_Name
In Product_Box I have a Dynamic TextBox called
Prod1_Name
what path do I give the variable
Ive tried _level0.Prod1_Name and _root.Prod1_Name
then I tried combinations of the above names in linear sequence with dot notation between each name
Im stumped please advise me.
View Replies !
View Related
Referencing Variables In Path? HELP
Hey All,
I'm pretty certain this is an easy one, just can't figure it out. Here's the code....... Some of it is commented out. The issue was that everytime the loop ran through the images would reload starting from top down. So I'm trying to set this up so that the instance names of the movieclips are also designated by the loop. The movieclip instances are "th1, th2, th3, etc....."
clipData = new XML();
clipData.load("clips.xml");
clipThemes = new Array;
clipData.ignoreWhite = true;
function myOnLoad () {
clipThemes = clipData.childNodes;
for(a=0; a < clipThemes.length; a++){
//a = a+1;
TH1 = clipThemes[a].firstChild.attributes.thumb;
CL1 = clipThemes[a].firstChild.attributes.clip;
TI1 = clipThemes[a].firstChild.attributes.Title;
CT1 = clipThemes[a].firstChild.attributes.clipTxt;
monster = "th"+[a];
trace(monster);
//// the trace here works!!!!!
_root.monster.spot.loadMovie(clipThemes[0].firstChild.attributes.thumb);
_root.monster.title_txt.text = (clipThemes[0].firstChild.attributes.Title);
////// The issue is here..... How am I referencing "monster" wrong?????
/* th2.spot.loadMovie(clipThemes[1].firstChild.attributes.thumb);
th2.title_txt.text = (clipThemes[1].firstChild.attributes.Title);
th3.spot.loadMovie(clipThemes[2].firstChild.attributes.thumb);
th3.title_txt.text = (clipThemes[2].firstChild.attributes.Title);
th4.spot.loadMovie(clipThemes[3].firstChild.attributes.thumb);
th4.title_txt.text = (clipThemes[3].firstChild.attributes.Title);
th5.spot.loadMovie(clipThemes[4].firstChild.attributes.thumb);
th5.title_txt.text = (clipThemes[4].firstChild.attributes.Title);
*/
Any help would be great!!!!
View Replies !
View Related
Dynamic Path's W/ Variables
hey guys,
i cant figure out how to do this in AS 3.0, but I want to do something like so:
var numz:Number = 1;
DocumentClass(root).container_mc.path[numz]_mc
numz++
know what I mean?
where the numz gets put in on the path, how do I put variables into paths?
thanks =)
View Replies !
View Related
Help Creating A Path Using Variables.
HI
I;m trying to create a path to a movievclip created with attachMovie. I need tio create the path using variable:
_root.var1.var2.gotoAndPlay("something");
How can I tell flash that var1, var2, etc are variables and not a relative path?
Tks,
Edited: 01/16/2007 at 10:50:24 AM by oscmejia
View Replies !
View Related
Variables In Target Path?
I have been searching all over and cannot find a solution to this problem. It works fine when I hard code it but I am trying to get this to work with the for next loop. It apears that the variable arrays are giving me a problem. Whatever I try gives me "TypeError: Error #1010: A term is undefined and has no properties"
Code below:
var menuCurrentPos:Array = new Array(0,1,2,3,4,6);
var menuDefaultPos:Array = new Array(0,1,2,3,4,6);
var menuMCArray:Array = new Array("btnAbout_mc", "btnCustDes_mc", "btnMaint_mc", "btnLogos_mc", "btnWebDesign_mc", "btnHome_mc");
for (var i:Number = 0; i < menuMCArray.length; i++){
trace("i: " + i + " " + menuMCArray.length + " " + menuMCArray + " " + menuCurrentPos);
this.menuTabs_mc.setChildIndex(menuTabs_mc.menuMCArray, menuCurrentPos);
menuTabs_mc.menuMCArray.addEventListener(MouseEvent.ROLL_OVER, buttonOver);
menuTabs_mc.menuMCArray.addEventListener(MouseEvent.ROLL_OUT, buttonOut);
}
Any suggestions would be appreciated.
Thanks
View Replies !
View Related
Inserting Variables Into A Path...
Hi guys,
having a bit of a problem, it's so basic but my brain is struggling.
Code:
on (release) {
thisid = "2";
_root.i_icon(thisid).iconstates.gotoAndStop(1);
}
I'm not sure what I am doing wrong here, I just want to insert the variable defined on line 2 into the path, I have tried everything and nothing seems to work...any ideas would be much apreciated,
thanks
View Replies !
View Related
Problem With Variables And Path To Mc
Hey everybody!
A short description of my project:
1) Fetching data from mysql
2) Make x numbers of buttons using duplicateMovieClip. (depends on num_rows from db)
3) Set text in buttons from db with dynamic text.
I'm talking about the buttons on the left side here:
http://www.distorted-personality.com/index2.html
Here's the code-snippet i experience problems with.
Code:
for(var a=0;a<10;a++){
_root.btn_archive.duplicateMovieClip("button"+a,_root.getNextHighestDepth());
button0.archive_txt = lv.tittel0;
button0.onRollOver = function(){
this.gotoAndStop(2);
}
... And so on.
If you look a the code above, button0 <- I want that to be something like: button[a].
If I do a trace on trace("button"+a), it works perfectly.(returns button0, button1 ... etc)
If I make it a variable, var tmp:String = "button"+a;, it will also give me the same result.
But if I try to target a mc with path, example tmp.onRollOver = function(){, it will not work.
- button[a].onRollOver doesnt work.
- "button"+a.onRollOver doesn't work.
How can I integrate that a-variable into my path to the newly created mc's?
Guess any of you in here can help me out! I hope so!
Thanks in advance.
View Replies !
View Related
Target Path Using Variables?
Hey everyone,
I've run into a problem where I want to use a variable as part of a target path...example..
Code:
var myVar:String = String("myMC");
//say I have a MC with this path...this.myMC
this.myVar._y = 3;
is there a way to do something like this? Everything I try doesn't work, yet I can use this concept in a different way.
Code:
//this works fine
var newColor:Color = new Color("States." + myArray[i]);
I have tried the tellTarget(object) also the with(object) but I can't seem to get anything to work. Any ideas?
View Replies !
View Related
Variables In A Target Path?
i have this target path
grnd = _parent.ground2._y;
i want the object to move up to the next ground object i have -
there's 4 levels and when they push the up arrow i want them to move up one level and if they push the down button i want them to move down
level1 = ground1
level2 = ground2
level3 = ground3
level4 = ground4
here's waht i have that doesn't work
PHP Code:
if (Key.isDown(Key.UP)) {
if (i<4) {
i++;
}
rGrnd = "ground"+i;
grnd = _parent.rGrnd._y;
}
this comes up undefined
i know you could do it by asking what ground its on and then go up or down from there but if i could find a way to use variables it work be alot easier
View Replies !
View Related
Question: Using Variables In A URL Path?
I am getting a variable from a PHP page and trying to use that number in loading an image in flash. Here is the code.
Code:
imgNum=_root.newNum;
loadMovieNum("/images/small/"+imgNum+".jpg", 2);
Currently it is not working. I have a dynamic text field showing the correct number using 'imgNum' as the var:
The code works fine if I use:
Code:
imgNum=1;
loadMovieNum("/images/small/"+imgNum+".jpg", 2);
What am I doing wrong here? Thanks for any help!
View Replies !
View Related
FSCOMMAND With Path Variables
Greetings,
This is my first attempt at working with flash since about 5-6 years ago, so I guess I am new again.
To note: I am using MX 2004 Education Edition. I am creating an SWF that runs in Projector (.exe).
There is a button that says "Browse Contents" that, when clicked, will open windows Explorer (explorer.exe) and show the contents of the disc. I am having it launch a KIX script, which works properly from the RUN line and CMD. I am wondering if there is a syntax problem with my code.
Both WKIX32.EXE and browse.txt are in the FSCOMMAND folder. I am able to get this Projector to open other applications via a Batch file (such as an InstallShield app) but not through KIX. I am using KIXTart because I was unable to create a batch file that could detect what CD drive the Projector was on.
Here is the code:
Code:
on (release) {
fscommand("exec", "WKIX32.EXE browse.txt");
}
Possible solution is for me to fix my code OR find out a way to make with a BAT file.
The KIX script code is as follows (limted):
Code:
IF EXIST ("D:fscommandsetup.bat")
$cddrive = D
ENDIF
RUN "Explorer /root,"+$cddrive+":"
I imagine that Projector is having a problem opening KIX and not running the script.
Thanks
View Replies !
View Related
Loading Variables With A Relative Path
Hi!
I´d like to know how do I have to write the relative path to get a .txt that is placed in another folder. This is, inside my project folder there's another one called "texts" that includes several .txts
If I write:
loadVariablesNum ("\texts\mytext.txt", 0);
it works when publishing if I open it with Netscape , but it doesn´t when using IExplorer
How can I solve this??
Any good idea?
View Replies !
View Related
Setting Variables With Variable For Path
Flash 5 - Trying to set a variable use a variable to determine the path. Could one of you kind folks send me in the right direction?
This works
_level0.movie1.movie2.Var1 = _root.Item1[0];
This Doesn't
Var = "Var1"
Path = "_level0.movie1.movie2." add Var;
path = _root.Item[0]
I want the second Path= to represent the actual path and not reset the path var!
I guess my real question is how to I use an expression to represent a path.
Thank you.
MrKicks
View Replies !
View Related
Path Trouble In Loaded Variables
Im trying to load variables into a mc in a movie, but i cant get them connected. Anyone got any ideas ?
Im loading the variables into level 0, trying to loadMovie them using loadMovie(variablename, "target") in the mc. This does not work.
Also, i want to chech if one specific value of a variable (fps) in level 0 is the value i want it to be. An if statement of a button going:
if (fps == 5) {
_root.framecount.GoToandPlay(20);
}
if (fps == 8) {
_root.framecount.GoToandPlay(25);
}
does not work.
PLZ help, and thanx again.
View Replies !
View Related
Using Imported Variables As Part Of A Path
I'm having a problem getting an image to show dynamically in flash mx. It works fine with the following action script:
var LocationToImages = "images/";
var FileType = ".jpg";
var MyArray = new Array();
MyArray[0] = LocationToImages+"imagename"+FileType;
loadMovie(MyArray[0], "horse1");
However, I don't want to have the actual name of the image ("imagename" above) stored in the action script. What I have tried is to import the image name as a variable and then use this as part of the array to show the image. Here's what my action script looks like...
loadVariables("variables.txt","");
var LocationToImages = "images/";
var FileType = ".jpg";
var MyArray = new Array();
MyArray[0] = LocationToImages+ImportedVariable+FileType;
loadMovie(MyArray[0], "horse1");
That doesn't work. I get an error when I test the movie:
Error opening URL "file:images/.jpg"
Obviously it's not reading the imported variable at all.
Admittedly, I'm a novice when it comes to action script and I'm not even sure if what I'm trying to do is possible in MX. If anyone has any suggestions or even a shove in the right direction would be much appreciated.
View Replies !
View Related
Path Names Stored In Variables - How Do I Use?
HI
I have one main movieclip which contains everything
i need to set a variable to a path ie. _parent.floorMain.swatches
the variable is called swatchMe and stored in the main timeline of the one main movie and is assigned the values on the press of a button.
Then on the press of an mc i want the swatchMe path to gotoAndStop at("X"). If hardcoded into the on(press) of the mc as _parent.floorMain.swatches.gotoAndStop("tiles")//for example, it works fine. I cannot get it to work if using the swatchMe variable though - have tried creating it as a string an Object and an mc to no avail. So obviously messing up somewhere - as a string the value is 'correct'- but no good - as an object it seems to be undefined in the debugger and when i try to use it with a 'with' command, etc.
Help! Tearing out what little hair if have left. If it would help i can strip the relevant bits out of the overall flash file and upload over the weekend
I know this should be easy - i am at a complete loss as to why i can't get this to work.
Thanks in advance, Tom
View Replies !
View Related
[MX] Path Problem With Loading Variables
Flash MX version 6 on Mac OSX platform.
Hi I am trying to get a text field load variables from a txt file to work when I click a button.
It works when the text field is on the main timeline, but when it is in a movie clip it doesnt work. I know it is a path problem, but I have tryed adding _root. and all that but I cant get it to work.
This is the code I have on the button at the moment:
on (press) {
loadVariables ("document1.txt", "");
_root.infobox.mytext.scroll=x
}
The text field variable name is: mytext
and I have named the movieclip the text field is in: infobox
I haved spent hours on this and any help would be loved!
View Replies !
View Related
Unique Flash Variables Sent Through Path
Hello all, I have an interesting dillemma. Many people are familiar with sending variables to flash through its file path.
example:
<param name="movie" value="Backgrounds/Flash/Movie.swf?var1=hi" />
here a variable named var1 is sent into the flash movie so when it loads the var1 will be set to equal hi. This is expected and works fine. However, what if I want a quote or backslash in my variable? like i want var 1 to equal hi"/\"
also, I want to do this with writing nothing different than hi"/\", so I don't want to have to write hi"\\", this is because the variables changes depending on the users customization.
example:
<param name="movie" value="Backgrounds/Flash/Movie.swf?var1=hi"/\"" />
this won't work unfortunately, because the backslash for one is a character with special meaning.
Anyone have any ideas for me?
I slight work around Is the use of the SetVariable javascript function, and through that I can make it work just as I like.
flashMovie.SetVariable("/:vartext",
document.form1.TextL1.value);
if I make document.form1.TextL1.value = hi"/\" it will send it exactly as it is, unfortunately after this function is ran the variable is already set in the flash movie as undefined, and would require a function to run to get it to implement the variable where needed. Someone suggested I use the changeWatcher, but I don't understand it at all. tried to get it for a while and Couldnt get it to watch for the variable change.
Therefore, I come to ask if anyone knows how to get the variabel sent through to path to send exactly as is. This is a bit of a unique situation, so I hope I explained it clearly, apprecaite any help I could get.
View Replies !
View Related
What Path To Use For Variables When The .swf Will Be Loaded Into Another Movieclip?
Basically exactly what the title says. In a .swf, I create movie clip objects in a for loop like so:
Code:
_root.createEmptyMovieClip("box"+i,i);
var newMC = eval("box"+i);
I know, _root is bad because now when I have a movieclip in another file that loads this .swf, it doesn't draw the objects (I use newMC to draw the objects dynamically). I'm assuming this is because I've created the movieclip in _root, and it's trying to display within a movieclip, thus the info is inaccessible?
But how should I create the empty movie clip? I tried _level0 and that didn't work either.
View Replies !
View Related
Can't Set Dynamic Text Using Variables Within Path...
I have a bunch of dynamic text boxes called date0_txt + date02_txt, date1_txt + date12_txt, and im trying to put the text in using the following xml stuff, but nothing comes up in the text boxes. If I set it without the [] variable in the path, it works fine..any ideas? The XML is working, for sure.
ActionScript Code:
//this does not work
this["date"+numz+"_txt.text"] = tourInput.Tour.datez.text()[numz] + " " + tourInput.Tour.showtime.text()[numz];
this["date"+numz+"2_txt.text"] = tourInput.Tour.city.text()[numz];
numz++
ActionScript Code:
//this does work
date0_txt = tourInput.Tour.datez.text()[numz] + " " + tourInput.Tour.showtime.text()[numz];
date02_txt = tourInput.Tour.city.text()[numz];
numz++
View Replies !
View Related
AS3: Variables On EventListener - Path Problem?
hey, im a noob when it comes to heavy as.
i have a project with a nav and the code on the Nav is below:
Code:
stop();
var i:int;
//mainNav button functions
this.mainNav.welcomeButton.addEventListener(MouseEvent.CLICK, Welcome);
function Welcome(event:Object):void {
i = 1;
allTopMC.gotoAndStop(2);
}
this.mainNav.showcaseButton.addEventListener(MouseEvent.CLICK, Showcase);
function Showcase(event:Object):void {
i = 2;
allTopMC.gotoAndStop(2);
}
this.mainNav.servicesButton.addEventListener(MouseEvent.CLICK, Services);
function Services(event:Object):void {
i = 3;
allTopMC.gotoAndStop(2);
}
this.mainNav.aboutButton.addEventListener(MouseEvent.CLICK, About);
function About(event:Object):void {
i = 4;
allTopMC.gotoAndStop(2);
}
this.mainNav.contactButton.addEventListener(MouseEvent.CLICK, Contact);
function Contact(event:Object):void {
i = 5;
this.allTopMC.gotoAndStop(2);
}
and a few levels deep i have another MC that is supposed to read the variable and go to a frame depending on variable number.
that code is such:
Code:
stop();
var i:int;
if (this.mainNav.welcomeButton.i == 1) {
this.allTop.gotoAndStop(4); //Welcome section
} else if (this.mainNav.showcaseButton.i == 2) {
this.allTop.gotoAndStop(5); //Showcase section
} else if (this.mainNav.servicesButton.i == 3) {
this.allTop.gotoAndStop(6); //Services section
} else if (this.mainNav.aboutButton.i == 4) {
this.allTop.gotoAndStop(7); //About section
} else if (this.mainNav.contactButton.i == 5) {
this.allTop.gotoAndStop(8); //Contact section
} else {
trace("Error")
}
if you've forgotten, im a noob and im sure have elements in there that aren't necessary and dont have some that are. anyway, this code doesn't read the variable and go to the appropriate frame.
the first bit of code is on the main timeline (yes, i haven't made this in to a .as file)
the 2nd bit of code is a few levels deep and the relationship is such.
mainNav (main timeline)
allTop (main timeline)
-mc_allTop
- -mc_reverseFlipnew
- - -squareFlip_rev8New (this has the 2nd bit of code)
View Replies !
View Related
Some For Loop; Variables And Path Problem
Hello
i have this peace of code :
//this put me 3 textfields with three différent prices.
that's what i want.
PHP Code:
for (i=0; i<3; i++) {
_root.createEmptyMovieClip("test_mc"+i, i);
test_mc.createTextField("price", 14, 0, 170, 80, 20);
test_mc.price.text = "some dynamic set price"
//myClip is a button or an Movie clip with button behavior.
//and this puts me 3 different button/Movie clip
//and that's what i want.
var new_mc = test_mc.attachMovie("myClip", "bt"+i, i);
new_mc._x = 0;
new_mc._y = 190;
trace (new_mc)
trace (new_mc._parent.price.text)
// this the result of those to trace and that is ok
_level0.test_mc0.bt0
pice 1
_level0.test_mc1.bt1
price 2
_level0.test_mc2.bt2
price 3
// now if i do this with any button it gives me the same result
new_mc.onRelease = function () {
trace
trace (new_mc._parent.prix.text)
}
//this is the result of that trace and that is not what i want at all
last price
_level0.test_mc2.bt2
} // and of the "for" loop
So i was wondering if anyone as a solution mybe i have to figure a way of putting the "new_mc.onRelease " part outside of the for loops.
Please help me me me
View Replies !
View Related
Changing Movieclip Path With Variables
If I want to change a set of movieclips that all have the same name except they end in a different number i.e
movieclip1
movieclip2
movieclip3
whats the correct actionscript to refer to a movieclips path in terms of the name plus a numerical variable i.e
movieclip + var
so I can cycle through each one by altering the variable.
something like
var x = 1;
_root."movieclip" + x.othermovieclip.gotoAndPlay(1);
my attempts don't seem to have worked!
View Replies !
View Related
What Path To Use For Variables When The .swf Will Be Loaded Into Another Movieclip?
Basically exactly what the title says. In a .swf, I create movie clip objects in a for loop like so:
Code:
_root.createEmptyMovieClip("box"+i,i);
var newMC = eval("box"+i);
I know, _root is bad because now when I have a movieclip in another file that loads this .swf, it doesn't draw the objects (I use newMC to draw the objects dynamically). I'm assuming this is because I've created the movieclip in _root, and it's trying to display within a movieclip, thus the info is inaccessible?
But how should I create the empty movie clip? I tried _level0 and that didn't work either.
View Replies !
View Related
Path Depth And Variables Between Loaded .swfs
Hi,
I've been stumped for way too long so I'm hoping someone here knows what the problem might be with this file...
To understand the problem, you have to know the structure:
_level0 is a movie that holds all of the navigation.
_level0._root.object is an MC that holds all loaded .swfs (the guts, the content)
I have a button in _level0 with a text field that changes depending on the content that is loaded into _level0._root.object. This text field MUST be two levels deeper than root in order for it to be part of the interactivity within the navigation of _level0. (My draggable window panels, navigation palettes)
The text field changes when a button in _level0._root.object has been pressed. I do this by calling a function which sits in _level0 on the _root. The function is as follows (with 'blah' as placeholder for field variable name):
Code:
function fillField () {
_level0._root.nav.nav2.blah = "BLAHBLAH";
}
There's more to it but I removed the unimportant parts.
My problem is: The field will not fill if it is any deeper than _level0._root. So, the code above does nothing, even if the field is sitting in the nav2 mc. If the field were in the _root and I had this in my function:
Code:
function tempBack () {
_level0._root.blah = "BLAHBLAH";
}
...it works great. BUT I need the field to sit two levels deeper in order for it to drag with my windows and stuff.
Does anyone know why it won't work when I take it off of _root?? My field's variable name is even set to the path above (ideally _level0._root.nav.nav2.blah). Is it a limitation of flash or haha maybe it's me!! I owe you one if you can solve this.
Thanks,
Jessica
View Replies !
View Related
[F8] Finding Unknown Variables.. And Displaying FULL Path
Now, I know how to get names of objects, and variable names, but only if the variable is only one "deep", I.E it's path would be _root.variable. This renders it useless.
The code is:
PHP Code:
on (release) {
for (var prop in moviemc) {
textbox += (prop += " = "+moviemc[prop]+newline);
}
}
Lets say I load a SWF into moviemc. It has one variable _root.test, and another _root.test.test2. All it will find is that _root.test.
So what I need help with is how to find variables in the _root.variable that it finds. In the pervious example, find _root.test.test2.
Basicly I need to be able to find any given variable name, at any level.
View Replies !
View Related
Dynamic Path Variables And The "with" Statement
Hi,
here is a sample bit of my code that I am trying to put a dynamic path in:
Code:
filepath = d1.riviera_1
with (_parent._parent.filepath) {
_alpha = 100;
Increment(50, 4);
}
If I us the path _parent._parent.d1.riviera_1 in the "with" statment everything works as it should. For some reason the "with" statement does not like the variable filepath. I have tried all things I can think of like using "", eval, var, and cobination there of. Any Ideas on what the problem might be.
View Replies !
View Related
Dynamic Path Variables And The "with" Statement
Hi,
here is a sample bit of my code that I am trying to put a dynamic path in:
Code:
filepath = d1.riviera_1
with (_parent._parent.filepath) {
_alpha = 100;
Increment(50, 4);
}
If I us the path _parent._parent.d1.riviera_1 in the "with" statment everything works as it should. For some reason the "with" statement does not like the variable filepath. I have tried all things I can think of like using "", eval, var, and cobination there of. Any Ideas on what the problem might be.
View Replies !
View Related
Using Eval Function And Variable In A Path (target Path)
Hello,
I have to reprogram some of my website and it calls to conjugate strings in a way that's beyond my understanding. Please help me with some suggestions. Kind regards.
the original code is:
code:
if (_global.useCount<10) {
//hide
var diff = 10-_global.useCount;
for (diff; diff>0; diff--) {
eval(String(11-diff))._visible = false;
}
}
There are buttons named 1 to 10 and this turns off the ones that are not used. Now I want to nest those buttons in subclip "buttonsRow", instead of having them on main timeline. How do I rewrite that code to make it work with new path?
I have already tried the "associative array" method, but it don't really know how to pack the whole eval function in there. I've tried many combinations, like:
code:
this.buttonRow[eval(String(11-diff))]_visible = false;
//or
this.buttonRow["eval(String(11-diff))"]_visible = false;
//or
buttonRow[eval(String(11-diff))]._visible = false;
//or
buttonRow["eval(String(11-diff))"]._visible = false;
//or
buttonRow[eval(11-diff)]._visible = false;
// or
buttonRow[8]._visible = false;
//the last one at least turns off button 8, lol
Some of those return syntax error and some just don't work. Anyone have any ideas? Thank you again.
View Replies !
View Related
Cannot Export An Avi Of Motion Along A Path When Path Is Specified With Action Script
Hello!
I have the following problem: I am using Flash 8 Professional to produce a series of avi files showing the motion of a dot along different paths. Whenever I use the drawing tools to draw the path everything is all right: I can export both a swf and an avi file showing the motion. The problems start when I use action acript to specify the path: then a swf can be exported, but not an avi file (Flash acts as if it is exporting but the avi file produced shows only a stationary dot). Can anybody help me?
View Replies !
View Related
_root.path="http://www.sitename.com/path/FlashSite/"; Script Issue While Online
Hi there,
I inserted _root.path="http://www.sitename.com/path/FlashSite/"; in the beginning of my action script (2.0). This script accessing contents from an access database, which is working fine, when I tested from my local system folder. But no content from database is displaying while it tested from my localserver (127.0.0.1/path/FlashSite) or from online server.
From a search I found it might be the issue with "Network Access Warning". Is there any other reason? If this is the reason, then how can I resolve it?
For example, how should I replace this -
setTimeout( function(){ _root.content01.content02.gotoAndStop("cont_a");}, 1000 );
Thanks in advance
Shine
View Replies !
View Related
Variable Path Name --> Path=_root
instName="inst1";
path="_root";
Element.prototype.setVisible = function(){
[path+"."+instName]._visible=true;
}
I am trying to build a variable path to an instance. Normally I would do something like this[var]._x, but this doesn't work with _root.
Any ideas?
View Replies !
View Related
_root.path="http://www.sitename.com/path/FlashSite/"; Problem While Online
Hi there,
I inserted _root.path="http://www.sitename.com/path/FlashSite/"; in the beginning of my action script (2.0). This script accessing contents from an access database, which is working fine, when I tested from my local system folder. But no content from database is displaying while it tested from my localserver (127.0.0.1/path/FlashSite) or from online server.
From a search I found it might be the issue with "Network Access Warning". Is there any other reason? If this is the reason, then how can I resolve it?
For example, how should I replace this -
setTimeout( function(){ _root.content01.content02.gotoAndStop("cont_a");}, 1000 );
Thanks in advance
Shine
View Replies !
View Related
Wrong Path Given, What Path To Use?, And Why?
Since the beginning of my Flash time, i never solved the 'giving path' problem in Action Script.
Most of the time my paths work, but sometimes they only work in an empty .fla file and not in my homepage.fla file with the code in another scene.
This time it's the code in the timeline (layer: actions, frame 2, scene: control_panel_sc, .fla file: homepage.fla):
stop();
ccbTime.addItem("tidfme2");
I tried naming the path to:
this.ccbTime.addItem("tidfme2");
super.ccbTime.addItem("tidfme2");
_root.ccbTime.addItem("tidfme2");
_parent.ccbTime.addItem("tidfme2");
_global.ccbTime.addItem("tidfme2");
_level.ccbTime.addItem("tidfme2");
_leven0.ccbTime.addItem("tidfme2");
this._root.ccbTime.addItem("tidfme2");
even adding the scene name to it:
this._root.control_panel_sc.ccbTime.addItem("tidfm e2");
etc. (thus the above paths again + scene name)
All paths above don't work, meaning, i can't see the value in a component ComboBox, though in an empty .fla file i do see this value.
Because you can't help me out without actually seeing the .fla file, i uploaded it:
(every link is the same file, so just choose one URL).
http://pcxpert.dyndns.org/homepage.fla
http://pcxpert.dyndns.org/homepage.zip
http://www.uploading.com/?get=YQ0G1UIC zip version
http://www.uploading.com/?get=VWE6WZKO .fla version
http://members.lycos.nl/johnwhello/homepage.fla
http://members.lycos.nl/johnwhello/homepage.zip
ftp://pcxperting:flash@pcxpert.dyndns.org/homepage.fla
ftp://pcxperting:flash@pcxpert.dyndns.org/homepage.zip
Also, you're authorized to change any file at ftp://pcxperting:flash@pcxpert.dyndns.org (the future pcxperting.com that is made by and made for pcxperts)
View Replies !
View Related
AS3 - Path Problem ? Var In Path Problem Not Working
hitrect1_mc.buttonMode = true;
hitrect2_mc.buttonMode = true;
hitrect3_mc.buttonMode = true;
hitrect4_mc.buttonMode = true;
hitrect1_mc.addEventListener(MouseEvent.CLICK , cl1);
hitrect2_mc.addEventListener(MouseEvent.CLICK , cl1);
hitrect3_mc.addEventListener(MouseEvent.CLICK , cl1);
hitrect4_mc.addEventListener(MouseEvent.CLICK , cl1);
function cl1 (e:MouseEvent):void{
xa=e.currentTarget.name.charAt(7);
for (i=1;i<=xa;i++){
targets = "bar"+String(i)+"s_mc";
trace (targets);
soundrect_mc.targets.gotoAndStop(2);
}
well it traces bar1s_mc if it's exact as the code.
if i remove soundrect_mc.targets.gotoAndStop(2); it traces all targets.all 4 of them.How do i make flash recognize "targets" as a path to a movie clip ?
View Replies !
View Related
EXTREMELY URGENT - Creating Global Variables Using Names Of Other Variables...
I have variables xtile and y tile within a movie, and I need to create a global variable that will tell all other movies that this particular movie is situated on tile [xtile][ytile], so I need to know how to create the global variable: _root.objectmovie_xpos_xtile_ypos_ytile = true;
I know how to create global variables, and how to have other movies read them, but how do I actually create a VARIABLE with this name? I tried set ("_root.objectmovie_xpos_" + xtile + "_ypos_" + ytile") = true, but that doesn't work (which I kinda knew already but thought I would give it a shot)
any ideas peeps?
please help, its vital to a project I am doing
cheers all
View Replies !
View Related
My Variables Load With LoadVars...how Do I Execute A Loop To Assign Variables?
I have 52 (one for each week) duplicated MCs, a loadVars(), and variables "sermonTitle" and "airDate," which I'm trying to assign with the following:
this.airDate=_root.loadContent["airDate" + sermonDate];
this.sermonTitle=_root.loadContent["sermonTitle" + sermonDate];
which is placed in an onClipEvent (enterFrame) handler of the button which is duped . The vars load when I click Video > 2001.
The vars loaded have values named sermonTitle1, sermonTitle2, etc. and the same for airDate. The numbers attached reference the sermonDate which has already been assigned though my duplicateMovieclip loop:
num = 52;
ystart = b._y
n = 1;
while (n <= num) {
duplicateMovieClip("b", "b" + n, n);
setProperty("b" + n, _y, ystart + n*17);
this["b"+n].sermonDate = n ;
trace(this["b"+n].sermonDate);
n = n + 1;
}
I've tried attaching the assign code to the dupMovieClip loop:
num = 52;
ystart = b._y
n = 1;
while (n <= num) {
duplicateMovieClip("b", "b" + n, n);
setProperty("b" + n, _y, ystart + n*17);
this["b"+n].sermonDate = n ;
this["b"+n].airDate = "airDate" + n;
this["b"+n].sermonTitle = "sermonTitle" + n;
trace(this["b"+n].sermonDate);
n = n + 1;
}
setProperty("b", _visible, 0);
and it works - as far as assigning the correct value to the correct button, but it does not associate the loaded vars with them.
The SWF is VERY sluggish, though, which makes me think the onclipEvent is not the best way of assigning vars. I get the trace(this) showing all of the variables loading, so I know that's not the problem.
Does anyone know how to best assign these? I have been advised to use a loop for it. How would I go about executing a loop for this, as I will have navs loading in different text files - Thanks
Link to SWF:
HERE
View Replies !
View Related
Virtual Student Yrbook: Variables>Arrays>Variables? SOMEBODY RESCUE ME
Hello, All.
I am totally stumped. I am creating a student virtual yearbook, which displays students names with pictures. I cant find a totally understandable tutorial that teaches me how to extract variables from an array. So I created an asp file that writes out all of the student records to different variable names, and load them using loadvariablesnum(). Using this ASP file works, but once I click the exit button to take me back to the front page, it is as if all of my other variables are erased.
I dont completely understand levels when it comes to loading variables, so everything is loaded like this
loadVariablesNum("http://10.0.1.2/tp/tpod/processGet_studentInfo.asp", 0, "GET"); --- "POST" gives me the same results...
To view the pictures you would click a button on SCENE 4, and it takes you to "VIEW STUDENTS PICTURES" - SCENE 11. 'EXIT' sends you back up to Scene 4, which runs an ASP file which simply grabs a message that is updated every 30 minutes. What Level would I use here??? I have tried many.
Everything works beautifully until I exit the VIEW STUDENTS PICTURES page from Scene11
I've written a pretty sizeable file that uses lots of variables.
I am pretty sure that the problem is with the ASP file: "processGet_studentInfo.asp" - because when I comment it out, the application works fine.
::::::::::::SUPPORTING INFO BELOW:::::::::::::::
Here are the variables that "processGet_studentInfo.asp" creates:
&varStudent1=Crystal&varImagePath1=http%3A%2F%2F10 %2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FCrystal%2Ej pg&varStudent2=Brandy&varImagePath2=http%3A%2F%2F1 0%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FBrandy%2Ej pg&varStudent3=Angel&varImagePath3=http%3A%2F%2F10 %2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FAngel%2Ejpg &varStudent4=Cathy&varImagePath4=http%3A%2F%2F10%2 E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FCathy%2Ejpg&v arStudent5=Destiny&varImagePath5=http%3A%2F%2F10%2 E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FDestiny%2Ejpg &varStudent6=Amber&varImagePath6=http%3A%2F%2F10%2 E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FAmber%2Ejpg&v arStudent7=lester&varImagePath7=http%3A%2F%2F10%2E 0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2Flester%2Ejpg&v arStudent8=paul&varImagePath8=http%3A%2F%2F10%2E0% 2E1%2E2%2Ftp%2Ftschool%2Fimages%2Fpaul%2Ejpg&varSt udent9=Ginger&varImagePath9=http%3A%2F%2F10%2E0%2E 1%2E2%2Ftp%2Ftschool%2Fimages%2FGinger%2Ejpg&varSt udent10=Brittany&varImagePath10=http%3A%2F%2F10%2E 0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FBrittany%2Ejpg &varStudent11=chad&varImagePath11=http%3A%2F%2F10% 2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2Fchad%2Ejpg&v arStudent12=jaden&varImagePath12=http%3A%2F%2F10%2 E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2Fjaden%2Ejpg&v arStudent13=Jami+Lynn&varImagePath13=http%3A%2F%2F 10%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FJami+Lynn %2Ejpg&varStudent14=kara&varImagePath14=http%3A%2F %2F10%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2Fkara%2 Ejpg&varStudent15=Cody&varImagePath15=http%3A%2F%2 F10%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FCody%2Ej pg&varStudent16=darla&varImagePath16=http%3A%2F%2F 10%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2Fdarla%2Ej pg&varStudent17=Jenna&varImagePath17=http%3A%2F%2F 10%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FJenna%2Ej pg&varStudentCount=17&varENDER=1
-----------------------------------------------------------
Here is the meat & potatoes of the ASP file that created this:
oRS.Open "SELECT * FROM STUDENTS", oConn, 2, 3
' Move to the first record
oRS.MoveFirst
'Loop to output all the query results to the document
do while not oRS.eof
' counter to give each record a sequential listing
counter=counter+1
Response.Write "&varstudentname" & counter & "=" & Server.URLEncode(oRS("studentname"))& "&varImagePath"& counter & "=" & Server.URLEncode(oRS("ImagePath"))
' move to the next record
oRS.movenext
loop
'LET FLASH KNOW THAT WE ARE DONE RETRIEVING
Response.Write "&varStudentCount=" & counter
Response.Write "&varENDER=finished"
:::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::
Please help.
View Replies !
View Related
|