Describe Path Inside Of Variable?
Hi there, I have a construction in which I target a movieclip. The movieclip name is dynamic and therefor decribed inside of a variable. The clip is not in the same scope as from where I target it so the path needs to be added. Only if I do that like this:
certainpath.variable. do what's needed it goes wrong off course, because the script will search for the variable in the scope that cartainpath is.
So how can I add the path to the variable?
many thanks for any help! kind regards game
DevShed > Flash Help
Posted on: February 26th, 2007, 02:56 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Using Variable Inside A "path" To An In-library Object -warning- Semi Noob Question
I am in the process of programming an "inbox" for my game in which there are many clickable objects which you collect as you play. When you click an object:
on (release){
using=true
objectselected="lightbulb"
_root.lightbulb._alpha=10
}
so when i click the lightbulb, it looks different, and assigns a few variables.
when i close then re-open the inbox, i want the previously selected object to still be selected and "lit up" so i typed for frame one:
stop();
if (using==true){
_root."objectselected"._alpha=10
}
but it gave me a syntax error. how do i make it "find" the object i want selected if i have the variable in the "path" of the object- im pretty sure it has something to do with the "getproperty" function, so i tried
...
_root.(getproperty(objectselected))._alpha=10
}
but that din work either... how do i type this??
i hope i was descriptive enough- i will check for an answer in 30 minutes- have to eat
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.
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?
Variable Take On Content Of A Root Variable And Not Its Path - Simple Please Help
Hi there ok my brain has died and fallen off somewhere , what i am trying to do is this:
l=0
l++
_root.advert= "_root.var" + l ;
then i have a text box on stage , dynamic, etc var: _root.advert
, vars are stored in a text file , vars are called, var1, var2 etc , text box needs to display variable contents, but at the moment it just says "_root.var1" etc and not the content s of var1 this is very simple problem but my brains dead please help.
-arran
Sting Variable To Mc Path - VARIABLE TYPES
Hey all Im building a variable like this
var m = "_root.subNav.subNav" + i;
When I do a trace to find the var type it comes back as a string so my function wont execute thinking it is a string and not a path. Does anyone know how to fix this or change the variable type on the fly in AS 1.0? Ive tried:
var m =eval( "_root.subNav.subNav" + i);
But that came back undefined....
Thanks.
Buttons Inside MC...what Is The Path?
Hi y'all! Attached is my fla. and what I am trying to accomplish is the same effect with the buttons: print, web, photography, and contact, when they are pushed, the scrolling part scrolls to the corresponding button...only I would like to use the mc menu with the hidden buttons.
When I attach the instance names to the buttons inside the mc, and add them to the scripting...nothing happens...(I think I have to change the path, but to what?)
can somebody help me...gobbles are you out there?
thanks in advance,
melanie
Target Path To An Swf Inside An Swf
Hi guys,
I have a little problem and I can't find the answer in previous posts. I have a swf in which I externally load another swf. Sofar no problem, i can target it, etc, BUT now I wan't to load an external swf into an empty movieclip inside that one. I hope I'm clear.
For example to load the first, my code is:
Loadmovie("1.swf", this.mc_content)
So the swf loads perfectly. but how do I load 1_1.swf inside a movieclip called "placeholder" that's in 1.swf from within 1.swf?
Path From Movie Inside _root
I'm pretty new at this and I have a problem that I don't seem to be able to solve.
I'm trying to jump from one movie (movie1_mc) inside the _root to another movie also in the _root (movie2_mc) and go to a particular frame in it (5)
This is the line of code at the end of the "movie1_mc"
_root.movie2_mc.gotoAndPlay(5)
Can anyone help?
Thanks in advance
Trying To Find The Right Path For Replacing A .swf Inside A MC
I've got a bit of a dilemna. I've got an empty movie clip (empty_mc) that is used to load in various .swf's. The MC that is current loaded inside this empty MC uses the this._lockroot=true; so it thinks this .swf is indeed the root layer. I've got an ADD TO CART button in my .swf and when you click on it, it should replace the .swf in this empty MC with another .swf called cart.swf but instead when you click on the button, nothing happens. Here's the code I'm using:
var loadrec = new MovieClipLoader();
addCart_btn.onRelease = function() {
loadrec.loadClip("store/cart.swf", "_root.empty_mc");
};
Now I've tried it with just _root, also tried just _parent, _parent.catalog_mc and so on and either it loads nothing or the wrong movie. Anyone got a clue what to do here?
How Do You Change The Path If I'm Inside A Movie
hi everyone,
can someone help me with this code? i think this is a simple one for some of you but i'm having some hard time making it function. I just want to use this code inside a movie. ex. this.TextHolder.... ect... (the textarea's instancename is TextHolder). It is a script which loads text files inside a textarea component.
here's the code:
================================================== =====
myStyle = new TextField.StyleSheet();
myStyle.load("example.css");
TextHolder.styleSheet = myStyle;
thisText = new LoadVars();
thisText.load("example.txt");
thisText.onLoad = function(success) {
if (success) {
TextHolder.text = thisText.myText;
}
};
================================================== ====
thanks a lot
How Do You Change The Path If I'm Inside A Movie
hi everyone,
can someone help me with this code? i think this is a simple one for some of you but i'm having some hard time making it function. I just want to use this code inside a movie. ex. this.TextHolder.... ect... (the textarea's instancename is TextHolder). It is a script which loads text files inside a textarea component.
here's the code:
================================================== =====
myStyle = new TextField.StyleSheet();
myStyle.load("example.css");
TextHolder.styleSheet = myStyle;
thisText = new LoadVars();
thisText.load("example.txt");
thisText.onLoad = function(success) {
if (success) {
TextHolder.text = thisText.myText;
}
};
================================================== ====
thanks a lot
About Refreshing The Value Of A Variable Inside Of Another Variable (in A Text Field)
Hello, I have a simple question, but I'm not sure this is possible in Flash:
I'll simplify the problem so that it's easy to understand.
I have a text field holding a variable called "products".
This variable is defined via ActionScript somewhere else, with something like this:
Code:
products = "Some text here" + variable1;
The problem is that, when "variable1" is updated, the value of "products" will obviously remain the same, as it hasn't been redefined (I could redefine it as [products = products + ""] or something, but if I don't include the "variable1" in the definition it won't pick its new value).
I really need to do this with just one text field, and I cannot redefine the whole variable "products" again, as it is much complex than this example and keeps storing info in different ways depending on what the user does.
Any suggestions?
Thanks in advance
Had To Describe?
Hello
Well I have seen on many sites where they have a interface which is all linked up( For example a long picture )and when the user clikcs on button 5 it will go fast to it and slow down when it is nearly there. Quite hard to describe, but I love this effect and I have no idea how to do it ???
Sorry about the lack of info !!! :|
Thanks
I Can't Describe This
Ok. Hopefully I describe this well enough. I have a button. I want it so after I hit the button, text fades, then it goes to the site I want to link to. How can I do this? I'm using Flash MX.
Shane
I'm Not Really Sure How To Describe This...
Right, (hi by the way) imagine I've got a repeating sequence of five key frames of me slapping my thigh. I want to repeat this for 120 frames or so but I need to be able to shrink and grow the sequence as well as move it around the stage while it is running. I know this is possible but I can't find any tuts and I'm closer to smashing up my laptop.
You know the crabs from "A Frightened Boy"? (http://www.rathergood.com/vid/) The crabs legs move on a loop and they still move around/grow and shrink smoothly with the rest of the body. I need to do something similar.
Cheers,
seph
Can Someone Describe The Get Timer()
my question is how can I use gettimer() to
do something after half minute or what ever
I have a MC and after a minute I want to play how can
someone describe that ?
Not Sure How To Describe This In One Or Two Words....
does anyone know how do the following (i've seen it before, so i know it's possible):
i'd like to make a movie that fills the full width/height of my browser window. inside of the movie is a repeating pattern that in turn, fills the browser window.
also inside of that movie, my main content movie is loaded. this content movie is a FIXED width and height and even though the outer movie with the background pattern stretches to fill the full browser window, i cannot allow the loaded in movie to resize. it should just remain centered in the browser.
any ideas? much thanks...
nick
Not Sure How To Describe This Problem...
I have a class, Typewriter, that takes a text string as an argument (among other arguments) and "types" it out letter by letter. This class also calls another class, Callout, which is intended to take several movie clips (which are just images) and assemble them on the stage to create a framed white rectangle (an empty callout box) on which I want the Typewriter text to render.
My problem is, although tracing indicates that Callout is working just fine as called by Typewriter, I get no framed rectangle.
If I call Callout from within the Flash IDE, it works fine. I cannot for the life of me figure out what I'm doing wrong.
I have remembered to import Callout within Typewriter, and tried several variations on instantiating Callout. None work. I am NOT getting any errors, and like I said, trace statements from within Callout all work nicely, showing me the values of arguments I'm passing. I have tried simplifying things by trying to display only a single movieclip from the library rather than all of them, but that doesn't work either.
I know I'm not missing an addChild() and I know that I'm not inadvertently hiding the Callout behind another display object.
I will resist the urge to show the code, in hopes that someone might have a suggestion without need of it. But I can include the code if it helps shed light.
Any suggestions? Much appreciated.
DEADLINE HELP: I Don't Even Know How To Describe It For A Subject
In plain english here's what I'm trying to make happen. A guy walks up to a ticket counter, is greeted, then leaves. When he comes back, the ticket agent remembers he was there and has a different greeting. What I've done:
oCE Enter Frame{
if ((_root.codeTrigger == false) and (hitTest is active){
display this text.
_root.codeTrigger = true;
}
However, since it's an enterFrame command it plays once and then the text goes away. I want the text to stay on the screen until the hitTest is inactive and then once the hitTest is active again it gives a different greeting. I thought some kind of trigger command could sneak me through an if loop but apparently not.
Am I making any sense?
This thing's deadline is Monday afternoon and this is my last big hurdle, hopefully!
Thanks in advance!
Layne
Can Anyone Describe The Workflow For This Website Nav?
Here's the url:
http://www.hypertemplates.com/templates/11195.html
I'm trying to create a similar nav system for my website, I'm not concerned with the search features, but I just want the top nav portion to have all the elements "fly into place" after loading, then have the main pic have some animation that loops with animated buttons such as the one in this template. I know this is a subjective question, since there's probably many ways to accomplish the same task, but I was curious to hear how different people would go about building such a thing before I start. Also, does anyone know where to get some simple, non-obnoxious click sounds for buttons (kind of like the ones in this template, maybe even more non-obtrusive)?
Thanks everyone, have an awesome new year!
Variable Path
hello
i have a movie clip with only one frame in it and it has a dynamic text box whose variable name is t1.The main timeline also has one frame which contains instance of that movie clip named as mc1 and also has another dynamic text box named v.in that frame i had given
v=_root.mc1.t1 to display the value of t1 in MC in the text box v.I had also tried v=_level0.mc1.t1.But noone displays the values in the textbox v.
whats the problem in that
bye
geethanandh
How Can I Use A Variable In A Path
i have a loop counting i up to the number of objects i want to scale. Is it possible to use a variable that's based upon a prefix and the number i as suffix in the path to object that is supposed to be scaled.
here's my code(variable(thing) is ok path is not working):
thing = "obj" add i;
// here is something wrong
_parent.thing._width = newsize;
_parent.thing._height = newsize;
thanks for your help!
Path To Variable
I want to set a path by having a variable dictate the path... having problems with the syntax:
dynamicNum = _root.somevar;
//this is the path depending on the dynamicNum brought back the path will change. not sure if this is the way to concat the dynamicNum...
well it must not becuz it does not work any ideas on the syntax?
_root.screenAtty + dynamicNum.popuptext.click=0;
Path As Variable
Objective
What I am trying to achieve is this. 20 buttons (dynamically generated). Each button displaying an external jpg which it loads into a picture viewer (this I have achieved). On clicking each button information about each of the pictures is loaded into a textfield from an external txt file (this I cannot achieve)
What I am Doing
I am loading 20 variables “picinfo1” to “picinfo20” from an external txt file “myData.txt”
Each of the variables contains text such as “my picture one” etc
I am dynamically generating buttons (within an mc) based on the number of variables in the txt file ie. 20
I have a textfield component called “textViewer”
If within the original button if I add the code _root.textViewer.text = picinfo1, the textViewer is populated by information stored in that variable is (obviously all the buttons display the information stored in that particular variable)
Using the looping function that I have to dynamically create the buttons I have a variable “infoCount”
When I add the following code
_root.textViewer.text = “_root.picinfo”+ infoCount - the text field just displays _root.picinfo1 , _root.picinfo2, _root.picinfo3 etc but NOT the information stored in those variables
It seems that it is being interpreted as a string NOT as a path. Is there any way that I can make Flash recognise “_root.picinfo”+ infoCount – as a path NOT a string
Sorry if this is a little confusing
paul
Using A Variable With A Path - Help
Hi there.
I know how to use a variable to reference an instance on the same timeline, like this (variable is inState):
this[inState].gotoAndPlay("rollOut");
but how would it work if i had to reference something along a path? would it be like this?:
this[_parent.InstanceName.inState].gotoAndPlay("rollOut");
Kinda confused! any help appreciated.
thanx!
S
[CS3] Variable In Path
Hi I want to do something like the following code but it doesn't work:
Code:
var page = "present" ;
mainframe.page.gotoAndPlay(2) ;
mainframe is a MovieClip object and so is present.
I want to be able the change the variable so I can play different movies/pages
Variable Path?
Hi guys, i need some hellp...
Lets say i have a variable on the _root level, in the first frame
_root.a = 0;
trace(_root.a);
This will output 0.
Now in the same frame i have a moviclip (movie_a) and within that a nother movie clip (movie_b)
if i put the following code in movie_b
trace(_root.a);
i get Undefined as my output...
Can anyone please help me in this matter?
Thank you
~Gabor
Using A Variable In A Path
I'm curious why this doesn't work.
ActionScript Code:
var whereTo = _global.addressDestination;
addressSubmit.onPress = function(){
trace(_global.addressDestination); // traces address_1_txt which is correct
_root.front_mc.whereTo.text = myAddText.text;
}
whereTo traces, so why doesn't it work?
Thanks!
Variable Within Path And More -please Help
something's fishy here. guess i'm seeing not the right path after staring at it too long:
i'm having some working functions that load external pics.
everything works but now i need to convert the filenames of the images into variables.
loadImages(thumbs, "images/pic14.jpg", 76.2, 266.4);
works. BUT
ActionScript Code:
picname = "pic14";
loadImages(thumbs, "images/[b]picname[/b].jpg", 76.2, 266.4);
not! what am i doing wrong? i tried all [] {} and whatnot....
do i need to define the variable as expression? i'm stuck.
please help!
Put A Variable In A Path ?
Hello all,
I cant figure out how to out a variable in a path.
these ares the "fixed" paths i have now
_root.alpha[var1 + "_movieclip"].label
_root.betas[var1 + "_movieclip"].label
What i want is to replace "alpha" and "betas" by a variable "var2"
any help is welcome,
Regards,
Peter
Using A Variable In A Path
I'm curious why this doesn't work.
ActionScript Code:
var whereTo = _global.addressDestination;addressSubmit.onPress = function(){ trace(_global.addressDestination); // traces address_1_txt which is correct _root.front_mc.whereTo.text = myAddText.text;}
whereTo traces, so why doesn't it work?
Thanks!
Using A Variable In A Path?
Hi people,
I'm currently kinda stuck on an app Im developing.
I want to use a variable within a path.
Lets say my var's name is "i" and it consists of a number that will be changed.
So its basically var i = 0 and in a loop it says i++
Now I want to target this var in a path.
Lets say app."textfield"+i.text = "test"
That actionscript is wrong, but it's there to give you an idea of what I'm trying to accomplish.
So basically: how do I target an object with a variable path?
Need To Add Variable To Path Name...
So I have a button that occurs throughout the entire movie on the main timeline. I'm declaring a variable on each frame, so if you hit that button on that frame, it should take that variable and use it in the path to something I wanted turned on via _alpha = 100.
So, I want it to be something like:
on (release)(
_root.movieContainer. + "The variable" +.thingToTurnOn._alpha = 100;
)
So, I've never done this before, and I don't know where to begin, I just know that I want that variable I declared on the main timeline to be used in that path when the button is clicked.
Xml Path As Variable?
I am trying to create an xml based site navigation that will drill down to an infinite number of xml levels. I have tried to send an xml path as a variable with the currently selected menu item but I doesn't seem to work. Here is my code, it seems as though it should work, but it does not. Any suggestions?
Code:
var nodeList = [];
var xmlSource:XML = new XML();
xmlSource.onLoad = function(success:Boolean):Void {
if (success) {
xmlRoot = xmlSource.firstChild;
xmlnodes = xmlRoot.childNodes;
total = xmlnodes.length;
for (i=0; i<total; i++) {
nodesHolder.attachMovie("node","node"+i,i);
nodeList[i] = nodesHolder["node"+i];
nodeList[i].xmlRoot = xmlnodes[i].firstChild;
trace(nodeList[i]. xmlRoot);
nodeList[i].name.autoSize = true;
nodeList[i].name.text = xmlnodes.attributes.name;
nodeList[i].onRelease = function() {
showCurrent(nodeList[i]);
};
}
resetLayout();
} else {
trace("XML Not Loaded!");
}
};
xmlSource.ignoreWhite = true;
xmlSource.load("nodes.xml");
function showCurrent(current) {
trace("Showing Current Node: "+current.xml);
currentCenterX = 0;
currentCenterY = 0;
xmlnodes = current.xmlRoot.childNodes;
total = xmlnodes.length;
trace(total);
nodeList = [];
menuItems = total;
angle = ((360/menuItems)*Math.PI/180);
radius = 250;
for (k=0; k<total; k++) {
current.attachMovie("node","node"+k,k);
nodeList[k] = current["node"+k];
nodeList[k].xmlRoot = xmlNodes[k];
nodeList[k]._alpha = 100;
nodeList[k]._x = Math.cos(angle*k-45)*(radius);
nodeList[k]._y = Math.sin(angle*k-45)*(radius);
}
}
Using A Variable In A Path
I'm curious why this doesn't work.
ActionScript Code:
var whereTo = _global.addressDestination;addressSubmit.onPress = function(){ trace(_global.addressDestination); // traces address_1_txt which is correct _root.front_mc.whereTo.text = myAddText.text;}
whereTo traces, so why doesn't it work?
Thanks!
Path & Variable
I have been trying different ways to put variable into a 'do' sentence (the variable is a path), but I haven't been able to do it... here's the AS Code... Anyone could give a little help with that.
ActionScript Code:
do {
u = 0;
nombre = new Array();
chain = "nombre" + u;
ruta = "colector." + chain;
this.ruta.text = aNombre[u]; //the problem
u = u + 1;
}while (u == vTotal)
TnX a lot..
Using Variable Within Path?
I want to set a path by having a variable dictate the path... having problems with the syntax:
dynamicNum = _root.somevar;
//this is the path depending on the dynamicNum brought back the path will change. not sure if this is the way to concat the dynamicNum...
well it must not becuz it does not work any ideas on the syntax?
_root.screenAtty + dynamicNum.popuptext.click=0;
Thanks.
GR
Variable In A Path
Can anyone give me some help.
Original code.
Code:
Thumbnailgrid.thumb4.thumb.loadMovie(baseurl+"images/hallimages/thumb/4.jpg");
I have added a variable to the call:
Code:
Thumbnailgrid.thumb4.thumb.loadMovie(baseurl+"images/hall/thumb/" + varx + "4.jpg");
That works fine.
How would I add a varible to:
Thumbnailgrid.thumb4.thumb
^Replace thumb4 with variable: varx
Thanks
Movieclip Playing Inside A Button....problem With Layer Path Crap
I have a button with code on it that effects a movieclip within said button. For some reason i can't get the commands to the movieclip...I don't really understand all that _child _parnet stuf so it's probly what i need to do here...this is the code i need to send to the movieclip within the button
on (rollOver) {
menu1.stop();
fra = menu1._currentframe;
if (fra>12 and fra<24) {
menu1.gotoAndPlay(fra-12);
} else {
menu1.play();
}
}
on (rollOut) {
menu1.stop();
fra = menu1._currentframe;
if (fra<12) {
menu1.gotoAndPlay(fra+12);
} else {
menu1.play();
}
}
HELP (not A Helpful Title I Know, But I Can't Describe My Prob)
Hi there,
I am using Flash 4 and am trying to get a movie clip to play when a button is pressed. I have both the button and movie clip on the main stage, have given the keyframe where the movie is placed an instance name, given the movie's first frame a stop action, and told the button to go to the second frame and play. It just does not work, I've tried everything I can think of. Here is the action for the button:
Begin Tell Target ("/test")
Go to and Play (2)
End Tell Target
Any ideas why nothing happens? I'm sure it is gonna be something real simple and straight forward, but I just can't work it out. I have no programming experience so please use idiot terms when answering.
Thanks In Advance
Ben
Movable Screen-tips - Best Way I Can Describe?
Hi
I wonder if anyone can help? I'd like to know how to code a movable graphic which moves with the cursor when placed over a button. Please see www.planetfootball.com. Click on Premiership and then roll over the team badges at the top... how is the team name box graphic achieved?
Thanks in advance
Ashley
Error #1502 - Do Not Know Even How To Describe The Problem
hi
i have a php file that output an xml for flash. i am getting all the data from the database but if i have a larger text i get this error message, after a long time.( but with that i still get the text,after the error message has sown in the output penal:
Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
at close_btn()
at mini_blog_fla::MainTimeline/showPost()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at fl.controls::SelectableList/handleCellRendererClick()
any idea what it is and what i can do?
best regards
ron
Passing Variable As Path Name
Hi all,
I have four MC's, named "person1" "person2" "person3" "person4" that have a first frame action of stop();.
I also have a set of buttons, all set a variable "i" to either 1,2,3 or 4, and a variable "f" to either 5 or 6.
I then want to send this variable to the correct "person" MC so that the correct one will play, from the right place
I've tried using several methods, all along the lines of:
_root.person(i).gotoAndPlay(f)
but the variable never seems to reach its target.
Any ideas why?
Cheers,
Dongle
User A Variable For Path?
hello,
I want to do the below.
_root.step1.date
Path = step1.date
_root."Path"
Is there anyway this can be done?
Thanks
Useing A Variable For A Path?
hello,
I want to do the below.
_root.step1.date
Path = step1.date
_root."Path"
Is there anyway this can be done?
Someone gave me this idea, which is not working.
try:
path="step1.date"
_root[path]
Thanks
A Question On A 'path' Variable
Hi, i've a big question, and i hope someone of you, FlashGURU , can help me!
I can give a variable (URL encoded) from an ASP page to a FLASH movie, so
i can have dynamic text on my flashsite... i've try it, work fine!
I like to pass another variable, this time with a path (http://...) to a SWF movie.
I wish to load a movie on a level or in a target-movie, but the path to
that movie will be generated dinamically by an ASP page!
Can i do this (or something like this)?
How i can do it (obiviously without Generator, turbine or such)?
Please,probably this is a newbie question...
but i need to know!
Thank you for all your support!
|