AttachMovie / Variable
Hi I'm trying to use attachMovie with a variable - so that the attached linkId is dynamic.Kinda like this photo = photo1 mcLoader.attachMovie("photo","photo",2) So the linkId = photo1 - only it doesn't work since photo is in " "... Hope someobe knows a way around this?
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 08-08-2007, 05:06 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
AttachMovie Variable
in a mc called found I have on frame 1:
Code:
var toestand:Boolean = false;
frame 5:
Code:
toestand = true;
then I attach this clip on my main timeline:
Code:
found_mc = _root.attachMovie("found","found_mc", 1);
this works;
but when I trace the variable, I get undefined:
Code:
trace (_root.found_mc.toestand);
probably something stupid??
AttachMovie And Variable Hel
Ok I basically have a navigation which has 5 buttons. What I want to achieve is when one of the buttons is pushed the sub navigation slides out on the right of it. I had planned on creating an mc on the stage that only had a mc inside which has an alpha of 0. This mc is motion tweened over frames for the slide out and slide in effect. Ok now the confusing part, basically I have created an array -
var select = new Array ("one", "two", "three");
then declared
two = "sub2"; (which is the name of an mc in the library I would like to load).
So when one of the 5 buttons on the main menu is clicked, it declares
this.onRelease = function() {
select = "two";
_root.sub.gotoAndPlay("close");
};
As the mc plays, say about in the middle it has an -
attachMovie (select, "select", _root.getNextHighestDepth());
This I hope would attach a submenu from the library into this mc which is then tweened. I'm trying to have just one motion tween set, that basically when an menu item is selected will load the desired sub menu into the motion tweened mc on stage. However I would like these sub menus to come from the library rather than load external swfs on. I hope this isn't too confusing, please help! Here is an example of a site which I am trying to accomplish this effect.
rga
It is the navigation on the left hand side. The navigation is probably structured a whole lot more complicated than what I could understand, but I hope the method I would like to try could get me similar results.
AttachMovie With Variable Name?
Hi,
does anyone know why this function is working fine (as long as I use the function only once - but the reason for that I get)
Code:
function CreateThumb(file,xp,yp,level)
{
_root.attachMovie("img_holder","img_holder", level);
img_holder._x = xp;
img_holder._y = yp;
img_holder.createEmptyMovieClip("img",1);
img_holder.img.loadMovie(file);
img_holder.onEnterFrame = function()
{
if(this.img.getBytesLoaded() >= this.img.getBytesTotal() && this.img.getBytesLoaded()>0)
{
this.img._width = 15;
this.img._height = 15;
delete this.onEnterFrame;
}
}
}
CreateThumb("images/MAAT.JPG",100,100,1);
and why this one doesn't - I simply used a variable for the attached movieclip
Code:
function CreateThumb(mcname, file,xp,yp,level)
{
_root.attachMovie("img_holder",mcname, level);
mcname._x = xp;
mcname._y = yp;
mcname.createEmptyMovieClip("img",1);
mcname.img.loadMovie(file);
mcname.onEnterFrame = function()
{
if(this.img.getBytesLoaded() >= this.img.getBytesTotal() && this.img.getBytesLoaded()>0)
{
this.img._width = 15;
this.img._height = 15;
delete this.onEnterFrame;
}
}
}
CreateThumb2("newname", "images/MAAT.JPG",100,100,1);
I think the code itself is self-explanatory, so I won't add any comments on that at this point.
It's really irritating having a head full off design ideas and meeting problems like this one
Thanks in advance.
AttachMovie IdName As Variable?
Is it possible to have a variable passed into the idName of an attachMovie string?
for example:
PHP Code:
var thumbvar = "brand";
_root.thumbs.attachMovie([brand],"big_thumbs",0);
I'd like to attach movieClips based on different variables. Each variable is in the library, and has the linkage identifier attached to it. I don't know if this is possible. Thanks.
Noel
Function Variable In AttachMovie
Hello!
This one is driving me nuts. I'm trying to make a global function that attaches a movie clip. I want the movie clip it attaches to be a variable, however, I can't figure out the syntax that puts the variable into string format. For example...
I want my function to as such:
Code:
placeMovie = function(theClip)
this.attachMovie(theClip, theClip, 100);
}
and the call would be this:
Code:
placeMovie(myMC_mc);
But it doesn't like that. If I wrap my variable in quotation marks, it breaks as well.
I know it's a simple question, but I can't figure it out, and figuring out the syntax will save me hours and hours. Thank you in advance!
Is It Possible To Use AttachMovie With A Variable ID Reference?
Hello:
I am trying to write an attachMovie statement with a variable feeding the ID parameter. Is that possible?
For Example:
fadeInVar = '"LS_body_home_ID"';
_level0.LS_hitArea_body.attachMovie([fadeInVar], "attached_LS_body", 1);
I can't quite figure out how to write this. I tried an eval function as well...
If you have any ideas, please let me know.
Thank you!
- Garrett
ListBox AttachMovie Variable.
Ok so Ive known about listboxes in flash for a long time. Now I have a chance use it. Forgive my ignorance in this.
My first task is to have a listbox of 50 items that will display a movieclip. Its going to get more complicated but I like to work in phases. I can do this without problems but Id like to export all my clips and have them display on demand. I thought this would be easy but I cant seem to get attachMovie to read a variable. Heres my code that works when the movieclips are on the stage.
ActionScript Code:
list.addItem("Red Box", redbox);
list.addItem("Blue Box", bluebox);
//
function displayDetails(c) {
trace (c.getSelectedItem().label);
trace (c.getSelectedItem().data);
textbox.text = c.getSelectedItem().label+" :";
var displayClip = c.getSelectedItem().data;
displayClip._x = 400;
displayClip._y = 50;
}
// 3
list.setChangeHandler("displayDetails");
I was thinking I could do something like:
ActionScript Code:
list.addItem("Red Box", redbox);
list.addItem("Blue Box", bluebox);
//
function displayDetails(c) {
trace (c.getSelectedItem().label);
trace (c.getSelectedItem().data);
textbox.text = c.getSelectedItem().label+" :";
var j = c.getSelectedItem().data;
_root.attachMovie(j, "displayClip", 10);
displayClip._x = 50;
displayClip._y = 50;
but that doesnt seem to work.
Any help is greatly appreciated. Im using MX
cheers
Reference Variable Overwrite With Attachmovie
Morning folks,
I am loading in an xml file (to populate some a series of buttons and their popups), it loops through, grabs textual data and checks attributes for thing like a pdf link/video clip link etc. That is all fine. However, as the attributes are checked, I want it to add a pdf icon to the popup (Infobox_mc) where necessary and store the link to it as follows (this is part of a loop, and subsequent if statement):
Code:
var pdf_mc = Infobox_mc.attachMovie("pdficon_mc","pdf_mc"+feature_count, this.getNextHighestDepth, {_x:30, _y:30});
Item_mc.main_btn.hasPDF= true;
Item_mc.main_btn.linkPDF = pdf_mc;
I then try to pull out the references:
Code:
GUI.prototype.DisplayInfo = function ( ){
GUI.DisableNavigation( )
Infobox_mc._visible = true;
this._Msg("This ref " + this.hasPDF);
this._Msg("This reference " + this.linkPDF);
.....
The first 'hasPDF' returns true/false correctly in every instance. The second 'linkPDF' only gives me back the very last instance of the attached movie, on the last button. eg, if there aer 10 instances, 0-9 will return nothing, the 10th will give me the desired '_level0.Infobox_mc.pdf_mc9.'
Its clearly some overwriting issue but ive tried everywhich way i know and now i need some help!
TIA Kirupa people.
PAssing A Variable Into An MC Created With AttachMovie
I am creating movie clips with a for loop using attachMovie, I would like to pass a variable into the clip itself at the time of it's creation. It seems simple enough, but my little brain is imploding...
So basically I got an MC: "clip"+i, which I would like to pass a variable (from an array), for it to use on it's own timeline. I want the next clip to be able to use the next variable in the array in it's own timeline.
thanks
AttachMovie And Dynamic Text With Variable
Ok, I'm stuck on a very simple problem.
I want to access a dynamic text field inside a movie clip, that I created using a variable as a name.
I have a movie clip whose instance name is cc_mc and a dynamic text field inside it, called textF.
THIS works:
Code:
var mname= "cc_mc"
this.attachMovie("cc", "cc_mc", this.getNextHighestDepth());
this.cc_mc.textF.text = "EEEEEEEEEEEEEEEEEEEEEEK";
(not the first line is redundant here)
THIS does not work: I cannot change the text field content.
Code:
var mname= "cc_mc"
this.attachMovie("cc", "cc_mc", this.getNextHighestDepth());
this.mname.textF.text = "EEEEEEEEEEEEEEEEEEEEEEK";
THIS
does not work either:
Code:
var mname= "cc_mc"
this.attachMovie("cc", "cc_mc", this.getNextHighestDepth());
this["mname"].textF.text = "EEEEEEEEEEEEEEEEEEEEEEK";
What is wrong with it?
Any help is greatly appreciated.
Stefano
Reference Variable Overwrite With Attachmovie
Morning folks,
I am loading in an xml file (to populate some a series of buttons and their popups), it loops through, grabs textual data and checks attributes for thing like a pdf link/video clip link etc. That is all fine. However, as the attributes are checked, I want it to add a pdf icon to the popup (Infobox_mc) where necessary and store the link to it as follows (this is part of a loop, and subsequent if statement):
Code:
var pdf_mc = Infobox_mc.attachMovie("pdficon_mc","pdf_mc"+feature_count, this.getNextHighestDepth, {_x:30, _y:30});
Item_mc.main_btn.hasPDF= true;
Item_mc.main_btn.linkPDF = pdf_mc;
I then try to pull out the references:
Code:
GUI.prototype.DisplayInfo = function ( ){
GUI.DisableNavigation( )
Infobox_mc._visible = true;
this._Msg("This ref " + this.hasPDF);
this._Msg("This reference " + this.linkPDF);
.....
The first 'hasPDF' returns true/false correctly in every instance. The second 'linkPDF' only gives me back the very last instance of the attached movie, on the last button. eg, if there aer 10 instances, 0-9 will return nothing, the 10th will give me the desired '_level0.Infobox_mc.pdf_mc9.'
Its clearly some overwriting issue but ive tried everywhich way i know and now i need some help!
TIA Kirupa people.
Assign An Incrementing Variable To An AttachMovie (experience With TweenLite Helpful)
hey guys -
i have a script which places a clip on the stage (well, just off it), and rotates the clip and then tweens it to a certain x/y coordinate based on the rotation using TweenLite, and all of this on a setInterval of 2 milliseconds. that works well.
thing is, i don't seem to be able to set a unique name based on the clipname and an incrementing number
basically (and this isn't the whole thing, this is just the general idea), it goes
Code:
interval = setinterval("dothis", 2);
var increment=0;
function dothis(){
attachMovie(movieICall, "movieICall" + increment; 1)
movieICall._x = blah;
_y= blah etc;
etc;
etc;
increment++;
}
so when i set the interval to 2 seconds, it moves everything well and there are no problems. when i set the interval to 2 milliseconds, the clips only get just onto the screen before disappearing. i''ve tried creating a function to handle the x,y, tween
so i could refer to the clip with a "this", but it doesn't change anything.
the only thing i can think of is that movieICall is not incrementing, and every clip on the screen is being referred to as movieICall, in which case the next case of x, y, tweening overwrites that last one and effectively kills the last one (but then why is it not just left sitting on the screen)?
i tried adding an overwrite:false to the end of the TweenLite, but that only let the tween happen once and then...nothing.
anyone have any ideas??
AttachMovie() Within Another AttachMovie() Created Instance?
I'm still struggling away on my web site, but I've made quite a bit of progress and I think my code has cleaned up quite a bit. I still have the issue of not being able to attach my new content box movie clip when the button is pressed. I am successfully able to load the data for that instance of the tab, and can access the variables. It also is able to run the newContentBox() function inside it with success, but when it tries to run attachMovie(), nothing happens. Could this be a problem with my depth? Or is it my nesting?
I have been thinking about making a global variable for depth that will increment each time anything is created, so every movie clip is guaranteed to be on its own depth. Would this be a solution?
The site can be viewed here.
The source can be viewed here.
All the data files are located in that directory as well.
This is really driving me nuts, and I want to get something solved so I can move onto the submenu creation.
AttachMovie Inside Another AttachMovie
is it possible to attach a movieclip, and then attach another inside of it? i'm trying to load in images via using loadMovie and XML (a little background) i want the image to be dropped in to have a mask applied to it so that the image appears as a rounded rectangle... here's my code for the for loop that attaches the movie clips...
PHP Code:
for (i=1; i<=totalImages; i++) {
attachMovie("multiplebox", "box_"+i, i);
movieNamer=_root["box_"+i];
}
is it possible to attach a movie inside of 'box_"+i'?
AttachMovie Within An AttachMovie? Not Working
So I've finished a project (let's call it Project Blue) where I use attachMovie which references a folder (of swf's) to place each page of the swf. It worked fine. Next, I made a master 'shell' to place this project (among others) into. To do that I used attachMovie again to place Project Blue in the shell.
But now my attachMovie pages for Project Blue won't show up. Does Flash have a problem with using an attachMovie within an attachMovie?
Thanks for any insight on this....
AttachMovie Nested AttachMovie...
I have in the root timeline an empty movie clip that loads other movies inside of it. Using the attachMovie function.
Inside one of these attachMovie clips I have a nest "attachMovie" clip as well but for some odd reason it's not working. Is there anything I should be aware of when nesting an attached movie?
How Do I Make A Variable Store A Variable? - Dynamic Input Stuff ...
Hey, I got a little problem which I've usually been able to work around but in this particular case there really isn't another way. I want to give in a variable, say "x+x" and then use it as "x+x" and not as their assigned values ...
my result should be that I can alter the course of a loop like this ... for example:
input in text field = x+x
for(x=0,x<=50,x++){
...
y[x]=x+x
...
}
and if I give in 2*x it would make y[x]=2*x
I have no idea if there's a way in flash to accomplish this but if there is I'd sure like to know, thanks for any help I receive, I'll check back here soon.
Dynamic Text Field Is Calling The Variable Name Instead Of Variable Content
I'm having a problem getting something to work. I'm sure it has something to do with string variables and my syntax, but can't figure it out.
I have variables named cust1, cust2, cust3, etc. that are being loaded from a text file (these are customer names that will display in a text ticker).
I want a dynamic text field to display the customer names in incremental order, so I created a variable that consists of the string "cust" + a numeric variable called custNumber. At the end of each pass of the movie, custNumber is increased by 1.
var custNumber = 1;
var custName = "cust"+custNumber;
I want the dynamic text field to call the variable custName, but I can't get it to work. It keeps displaying custName as a string ("cust1", "cust2", etc.).
So I created a new variable called scrollText for the dynamic text to call, and made scrollText = custName;. But it does the same as above.
How do I get my dynamic text to call the variable that I create with another variable?
I want my dynamic text field to display the variable cust1, cust2, cust3, which would be "Jones Plumbing," "Smith Electric" etc., but all I'm getting is "cust1", "cust2", "cust3" etc.
Thanks,
Thom
Problem Assiging Class Variable To The Main Timeline Variable .... PLEASE HELP
Hi Guys
I just can't seem to solve this problem!!!
I have a random class that generates a random image and an id number from an xml file and a main class that reads information from an xml file according to the id number.
I'm having trouble assigning my random id number from my class to the _root.id variable on the main timeline for my other class to read. I keep getting undefined???
Random Class Code:
Code:
import mx.utils.Delegate;
class randomClass {
public var target_mc:MovieClip;
private var _xml:XML;
private var myTotal:Number;
private var random_number:Number;
public var myFid:Number;
private var myPic:String;
private var myTitle:String;
private var myImages:Array = new Array();
private var myTitles:Array = new Array();
private var myFids:Array = new Array();
function randomClass(url:String, target:MovieClip)
{
target_mc = target;
_xml = new XML();
_xml.ignoreWhite = true;
_xml.onLoad = Delegate.create(this, onLoadEvent);
_xml.load(url);
}
function onLoadEvent(success:Boolean):Void
{
if (success)
{
var i:Number;
myTotal=_xml.firstChild.childNodes.length;
for(i=0; i<=myTotal-1; i++)
{
myImages[i]=_xml.firstChild.childNodes[i].firstChild.firstChild;
myTitles[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.firstChild;
myFids[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.firstChild;
}
random_number=random(myTotal);
myPic="<A href="http://www.mydomain/images/"+myImages[random_number">http://www.mydomain/images/"+myImages[random_number];
myTitle=myTitles[random_number];
myFid=myFids[random_number];
target_mc.title.text=myTitle;
var TheMovieLoader = new MovieClipLoader();
TheMovieLoader.loadClip(myPic, target_mc.new_mc);
var pictureLoaderListener = new Object();
pictureLoaderListener = TheMovieLoader.onLoadComplete()
{
target_mc.new_mc._x=-9;
target_mc.new_mc._y=-5;
target_mc.new_mc._xscale=40;
target_mc.new_mc._yscale=40;
}
TheMovieLoader.addListener(pictureLoaderListener);
target_mc.random_id.onPress = Delegate.create(this, onPressEvent);
}
}
public function onPressEvent() {
_root.id=myFid; //Undefined
trace(myFid); //ok
}
}
Main Movie Code:
Code:
on (press) {
var Obj:myClass=new myClass("<A href="http://mydomain/fanbase.xml",_root.viewer">http://mydomain/fanbase.xml",_root.viewer, _root.id);
}
It just keeps saying undefined but yet i seem to be able to trace myFid
Any ideas???
Thanks in advance
Problem Passing Variable Values (from XML) To Variable In Child Movie
I'm reading something from XML, and store it in a variable. I can trace the variable and it shows two items. I can display those two seperately with variable[0] and [1], meaning that it works as intended.
After that, I'm calling a movieclip, which is supposed to read that variable.. sadly, it can't do it. So I resorted to passing the content of the first variable to a variable inside the called movieclip. This works, and tracing the second variable shows both items from the first. However, I cannot access the items seperately with variable2[0] for example.
What's the problem? The second variable is currently a string. I tried to declare is as other things (like xml or array) as well, but that didn't help. Is there also a way to make this procedure unnecessary, i.e. can I somehow access the first variable?
I've attached the fla/xml/swf in case my description doesn't make sense!
Problem Assiging Class Variable To The Main Timeline Variable .... PLEASE HELP
Hi Guys
I just can't seem to solve this problem!!!
I have a random class that generates a random image and an id number from an xml file and a main class that reads information from an xml file according to the id number.
I'm having trouble assigning my random id number from my class to the _root.id variable on the main timeline for my other class to read. I keep getting undefined???
Random Class Code:
Code:
import mx.utils.Delegate;
class randomClass {
public var target_mc:MovieClip;
private var _xml:XML;
private var myTotal:Number;
private var random_number:Number;
public var myFid:Number;
private var myPic:String;
private var myTitle:String;
private var myImages:Array = new Array();
private var myTitles:Array = new Array();
private var myFids:Array = new Array();
function randomClass(url:String, target:MovieClip)
{
target_mc = target;
_xml = new XML();
_xml.ignoreWhite = true;
_xml.onLoad = Delegate.create(this, onLoadEvent);
_xml.load(url);
}
function onLoadEvent(success:Boolean):Void
{
if (success)
{
var i:Number;
myTotal=_xml.firstChild.childNodes.length;
for(i=0; i<=myTotal-1; i++)
{
myImages[i]=_xml.firstChild.childNodes[i].firstChild.firstChild;
myTitles[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.firstChild;
myFids[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.firstChild;
}
random_number=random(myTotal);
myPic="<A href="http://www.mydomain/images/"+myImages[random_number">http://www.mydomain/images/"+myImages[random_number];
myTitle=myTitles[random_number];
myFid=myFids[random_number];
target_mc.title.text=myTitle;
var TheMovieLoader = new MovieClipLoader();
TheMovieLoader.loadClip(myPic, target_mc.new_mc);
var pictureLoaderListener = new Object();
pictureLoaderListener = TheMovieLoader.onLoadComplete()
{
target_mc.new_mc._x=-9;
target_mc.new_mc._y=-5;
target_mc.new_mc._xscale=40;
target_mc.new_mc._yscale=40;
}
TheMovieLoader.addListener(pictureLoaderListener);
target_mc.random_id.onPress = Delegate.create(this, onPressEvent);
}
}
public function onPressEvent() {
_root.id=myFid; //Undefined
trace(myFid); //ok
}
}
Main Movie Code:
Code:
on (press) {
var Obj:myClass=new myClass("<A href="http://mydomain/fanbase.xml",_root.viewer">http://mydomain/fanbase.xml",_root.viewer, _root.id);
}
It just keeps saying undefined but yet i seem to be able to trace myFid
Any ideas???
Thanks in advance
Problem Assiging Class Variable To The Main Timeline Variable .... PLEASE HELP
Hi Guys
I just can't seem to solve this problem!!!
I have a random class that generates a random image and an id number from an xml file and a main class that reads information from an xml file according to the id number.
I'm having trouble assigning my random id number from my class to the _root.id variable on the main timeline for my other class to read. I keep getting undefined???
Random Class Code:
Code:
import mx.utils.Delegate;
class randomClass {
public var target_mc:MovieClip;
private var _xml:XML;
private var myTotal:Number;
private var random_number:Number;
public var myFid:Number;
private var myPic:String;
private var myTitle:String;
private var myImages:Array = new Array();
private var myTitles:Array = new Array();
private var myFids:Array = new Array();
function randomClass(url:String, target:MovieClip)
{
target_mc = target;
_xml = new XML();
_xml.ignoreWhite = true;
_xml.onLoad = Delegate.create(this, onLoadEvent);
_xml.load(url);
}
function onLoadEvent(success:Boolean):Void
{
if (success)
{
var i:Number;
myTotal=_xml.firstChild.childNodes.length;
for(i=0; i<=myTotal-1; i++)
{
myImages[i]=_xml.firstChild.childNodes[i].firstChild.firstChild;
myTitles[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.firstChild;
myFids[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.firstChild;
}
random_number=random(myTotal);
myPic="<A href="http://www.mydomain/images/"+myImages[random_number">http://www.mydomain/images/"+myImages[random_number];
myTitle=myTitles[random_number];
myFid=myFids[random_number];
target_mc.title.text=myTitle;
var TheMovieLoader = new MovieClipLoader();
TheMovieLoader.loadClip(myPic, target_mc.new_mc);
var pictureLoaderListener = new Object();
pictureLoaderListener = TheMovieLoader.onLoadComplete()
{
target_mc.new_mc._x=-9;
target_mc.new_mc._y=-5;
target_mc.new_mc._xscale=40;
target_mc.new_mc._yscale=40;
}
TheMovieLoader.addListener(pictureLoaderListener);
target_mc.random_id.onPress = Delegate.create(this, onPressEvent);
}
}
public function onPressEvent() {
_root.id=myFid; //Undefined
trace(myFid); //ok
}
}
Main Movie Code:
Code:
on (press) {
var Obj:myClass=new myClass("<A href="http://mydomain/fanbase.xml",_root.viewer">http://mydomain/fanbase.xml",_root.viewer, _root.id);
}
It just keeps saying undefined but yet i seem to be able to trace myFid
Any ideas???
Thanks in advance
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
How To Store A String Plus A Variable In A Dynamic Text Variable?
Hi,
I've got a dynamic text field with the instance name rightAnswer_txt.
I declare the variable in the frame it resides in, with the following code var rightAnswer_txt:String = "";
Then, when I want to populate it using the following code:
rightAnswer_txt.text = "You scored " + rightAnswers;
the script comes out with an error saying ...
**Error** Scene=Scene 1, layer=actions, frame=7:Line 15: There is no property with the name 'text'.
rightAnswer_txt.text = "You scored " + rightAnswers;
Any idea what this means anyone please?
Variable Scope - Dynamically Created Variable Not Working
Hi all,
For a movieclip obj, I created a dynamic variable and in the onLoadInit handler this variable is not accessible.
This is my code:
--------
var imagesList:Array = new Array("flagGreen.gif", "flagRed.gif");
var path = "images/";
var myMc:MovieClip
= _root.createEmptyMovieClip("myMc", _root.getNextHighestDepth());
myMc.url = path+imagesList[0];
var loader = new Object();
loader.onLoadInit = function(targetMc){
trace( "url1:"+targetMc.url);
trace( "url2:"+_root.myMc.url);
trace( "width:"+targetMc._width);
trace( "height"+targetMc._height);
}
var mcLoaderObj:MovieClipLoader = new MovieClipLoader();
mcLoaderObj.addListener(loader);
mcLoaderObj.loadClip(myMc.url, myMc);
-----------
Image is getting loaded. When myMc.url is passed as a param to loadClip, it is working, but inside onLoadInit it is printed as undefined.
Help will be appreciated. Thanks in advance.
- Kiran
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
Loading Variable Smarclip Into Variable Movieclip?
HO HO HO FashMonsters-
Damn, Loading a variable driven smartclip into a movie clip can be a lil' tricky. Problem is I think I need the movie clip to be a variable as well. My button action is calling up my movie clip instances which are referencing the variable smart clip. However, each button action loads a new movie clip atop the previous. I either need to remove the previous movieclip or make the movie clip a variable loading variable smart clips.
Da Dizawg wud LUV some Hizelp!
Dynamic Text Box Variable = Other Variable, No More Scroll
So I have this textbox. And I want it to display some text. And I want the text to scroll and I want the text to change when you click a button. W007 I did it I am done. But I have a little problem, and I do hope you can help.
I loaded variables from a text file into flash, gave the variables different names, and then I set the buttons that can be clicked on to set the dynamic text box variable to equal one of the loaded variables. Ít wouldn't scroll after that. Whats up wit dat.
I can get you the FLA if you want it, but I am hoping someone will just say oh ya, common mistake, you gotta check a box or something.
Make A Variable = A Variable From A Text Document
I'll try my best to explain this, but it might be easier to see the file itself, I zipped it up and can be found at:
DOWNLOAD ZIP FILE
(the flash file is not pretty, I am building the functionality first)
-----------------------------
The variable it is creating does not call up the variable in the text
document.
I have a textfield called: randomquote
the value for randomquote is being "created" by:
Set Variable: "randomquote" = "q"&VARX2
VARX2 is a random number being generated by:
Set Variable: "VARX2" = Random ( VARX )
VARX is a number being pulled from the text document:
Set Variable: "VARX" = (/:myNumber)
SO, If I hard code randomquote with the value q4 , then the variable q4 from the textdocument is pulled up correctly.
BUT, if randomquote equals q4 (generated from a random number) the variable q4 from the textdocument is not shown, but rather just a simple q4.
Passing Array Variable Name In To Component Variable & Getting It's Value
Hi, All
Anyone can solve my problem????
My Problem is that I want to store a array' s name in to a component variable. like this:-
working in this case
Scene action on timeline
_global.arr = "This is aray Test"
component parameters
VarName : _global.arr
Not working in this case
Scene action on timeline
_global.arr1 = new Array()
_global.arr 1[0]= "This is aray Test"
component parameters
VarName : _global.arr1[0]
in component I'm doing this on timeline action
abc.text = eval(VarName)
plz help me out of this
Regards
Ankur Arora
Php Variable -> Actionscript Variable (transfer Without Being Seen By User)
I am trying to secure up the sign up process with something similar to the "type these 6 letters"
the problem is, how to get a value between php(or any server-side language) and actionscript? I only know ways where the variable would be visible to a robot, rendering this extra sign-up step useless.
So I am wondering if there is a way to transfer a variable without it being seen during transfer?
I have a little bit of knowledge about public variable encryption and I know it would work for this but i have never implemented this encryption before. Is there a tutorial that shows how to go about creating a public encryption/decryption algorithm?
Change String Variable To A MovieClip Variable
Hi
I have been banging my head against a brick wall regarding the following problem which must be very simple to fix, just can't see the answer.
I have a class assigned to a movieclip called canvas. The class is called drawClass. I have called the instance of canvas on the stage 'drawingCanvas'.
When I trace "drawingCanvas" I get
[object drawClass]
which is fine. Tracing drawingCanvas.name gets me the instance name
'drawingCanvas'.
This is a String variable.
Basically what I am trying to do is pass the MovieClip name to another class. In my example the class 'toolBar', which can then interact with the MovieClip.
The problem is passing 'drawingCanvas.name' results in a String, so I get an error saying :
TypeError: Error #1034: Type Coercion failed: cannot convert "canvasArea" to flash.display.MovieClip.
I can't for love or money find a way to convert a String variable to a MovieClip variable! I have the name of the MovieClip, I just need to tell the toolbar class. But I can't find a way of doing this as the instance on stage is an object of drawingClass, not a MovieClip (unless MovieClips with attached classes are not treated as standard MovieClips?).
Any ideas are most welcome. I'm sure I am missing something obvious.
Thanks for looking
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.
Changing Root Variable With Text Variable
Simple question: I'm trying to change the value of a variable on the _root level (called "myVar") to whatever a user types into a text box (mytextvar) on the stage. I have a button that says:
ActionScript Code:
on (press) {
_root.myVar = _root.myTextVar;
}
It isn't working... any ideas how to make this work?
Apply Variable Values To Variable Names?
I have a gallery with a series of 5 thumbnails, named gallery_position_1, gallery_position_2, etc, up to 5. I am loading an image with XML into gallery_position_(#), and have a button on top of that with scripts on it.
My question is whether I can have an integer variable (call it x) that starts at 1 and can be put into a for loop, using it then on the end of my other variable like so:
for (x = 1; x < 6; x++) {
gallery_position_x.loadMovie(URL path to image);
}
I basically want to be able to "index" a regular variable by changing a number within its name. I know its a long shot, as I've never seen it done before, but I thought I'd ask, all the same.
Convert String Variable Into Movieclip Variable?
I have a variable called something like city_str which has a value of "toronto". I also have a moveclip (exported for AS) called toronto_mc.
What I want is a way of concatenating strings of "toronto" and "_mc" and assigning it to a movieclip variable called toronto_mc. Everything I try gives me a mismatch error in the compiler. I'm writing AS2 using Flash CS3. Any ideas?
Overwrite Variable Versus Delete Variable
I'm assuming that if you were to create a variable that referenced an instance of a class, then if you were to overwrite that variable with an instance of a new class, the old class would be deleted without explicitly deleting that class. Am I correct in assuming this?
Can't Update Movie Variable With Loaded Variable
i have a php file that loads an array of variables with paths that load into some text fields in duplicated movie clips. The php path is right, but it just doeasn't load them into the txt fields. How do i get and set the variables???
this gets loaded into th movie from the php file;
_level0.work.client_mc6.web_work.web_mc0.file0 = "rm1.jpg"
but it doesn't replace what is already in there??!!
_level0.work.client_mc0.web_work.web_mc0.file0 = "remove me"
how do i update the old vaiable with the one tha'ts loaded via PHP?
|||---> Variable Textfields And Variable Sizes?
ok... i'm trying to add tool-tips
i would like to have the dynamic textbox (which follows the mouse) resize itself based on the /:tip variable i have created
so that if /:tip = "" no textbox appears
and if /:tip = "flash 20k" the textbox would be the right size to fit the text
i'm trying to do this with the background feature turned on, so that the text is black on white
---
can anyone point me in the right direction?? much appreciated
-steve
Set Variable: Setting Variable Name Dynamically
hi...
i want to set a variable dynamically, i have done:
soundCount = 5
set (eval("loading"+SoundCount), 1);
i want the outcome as:
loading5 = 1
which i wanna check later...
is it right? because i m not getting the result when i
trace (loading5)
please help
Variable In Movie Clip With A Variable Name
Hello,
I need to find out the content of a variable in a Movie Clip with a variable name. I created several movie clips with "duplicateMovieclip" in a for... loop. Looks like this:
for (i=1; i<=5; i++) {
duplicateMovieClip (_root.oldname, "newname"+i, i);}
Now I want to know and set the content of a variable stored in this clip, but again in a for.... loop.
I tried it with:
"_root.newname"+i+".variable"=content;
This does not work. Anyone any ideas?
Thanks for any answer that might help me.
Greetings from cologne
Ole
Setting The Value Of A Variable, Checking The Value Of A Variable
i think this might be a simple question, but I can't figure it out and it's puzzled me for a long time. If I set a variable OnRelease - let's say I have 4 buttons that set a variable to 4 distinct values, depending upon which button is pressed. How do I create a check, later, from another part of the movie, for what the current value of that variable is?
Is the variable universal - that is once it is set, the entire movie sort of 'knows' what the value of that variable is? Or do I have to direct the attention of the movie back to the same clip or frame or wherever I set it. Either way, what is the syntax?
I hope I was able to explain this and that it makes sense to someone.
Thank you!
-ml
Variable Names Are Part Of A Variable Itself
hello,
i ahve a deadline and im in a bit of a mess, i was wondering if anyone knows the awnser to this one.
i am targeting a variable in another movie the name of the variable is ' ysh1 ' this is a score and the is 9 other they are ' ysh2 ' , ' ysh3 ' etc.
and a variable on the main time line called ' hole ' ,
it's value is ' 1 '.
this is the variable that targets ' ysh1 '.
set ("_level0.display.score.ysh"+_level0.hole, "_level0.display.score.ysh"+_level0.hole+"+1") ;
so it does target the variable, that works fine but i cant make the score increase by 1
im just try to increase the score by one evey time this function is called.
it's driving me mad.
any help would be great.
_root.variable -> Object Variable
Hi,
I am rather new to flash, so please bear with me
I've downloaded a flashmovie at http://www.flashkit.com/movies/Inter...8449/index.php ( a very beautiful window navigation menu).
The menuitems to build this window-menu are placed within the object as variables.
I want to put these variables into the root timeline (where I can retreive menuitems from a database). The object however cannot retreive variables from the root-timeline it appears.
I've tried using _global.varname in the root timeline, but it didn't help.
Is there a way I can make these variables appear within the object?
help appreciated
Patrick
Creating A Variable The Name Of The Contents Of Another Variable
Hi all
I've got a variable called "test"
Within "test" there's the string "monkey"
I want to create a variable called "monkey" in another movieclip and add a string to it.
How do i do this?
I've tried _root.movieclip.eval(test) = "blah"
But this generates an error....
any ideas?
Many thanks
|