I have attached the actionscript file on stage, however I can't access function or variables inside movieclip. Instead I can access them on main timeline, is there a way to access function and variables inside movieclip
This issue is my constant pain, and has set my project back some time. I'm creating a message system for my game, it's supposed to record events that happened during travel, 3 vars per message (topic, in game date, content)All the vars are in an external as file and a public class. The problem is they return blank in the mc's textfields while displaying correctly on the main timeline textfields at the same time. This is the code sitting inside the mc that doesn't work.
Code: import Variables; var variables:Variables = new Variables(); function setMsgSlot (e:Event) {[code]....
on the main timeline, even in the same frame, works perfectly, and i can't figure out why.
i have a symbol called character and inside that symbol i have a symbol called head and inside that symbol i have a variable called headtype... i want it to set to 5 from the main frame.
If I have a MovieClip called parent_mc and inside it I have another called child1_mc, I can use a variable for the "1" part of child1_mc and change the alpha for example like this:
ActionScript Code: var myVar:Number = 1; parent_mc['child'+myVar+'_mc'].alpha = 0.5;
What is the right syntax to use if child1_mc is not actually a child of anything and just sits on the stage? I have tried the following and it didn't work:
I am doing my first simple game using Flash CS5 and Actionscript 3.0. In this game the player would be able to create a new quiz where it would create an array and add sets of questions and answers to that array. I have been looking on how to do this or anything like it and it doesn't seem to be possible (at least in this way).
I'm pretty new to AS, I understand that whatever variables you have inside a function will be discarded once the function finishes? I need the value of a variable that's inside a function, I've tried declaring it outside the function, and also give it an initial value, but it seems that when the function finishes the variable goes back to it's original value.
Actionscript Code: for (var i:Number=1; i<=3;i++){ var char_name+i = event.target.data.char_name_ + i;//It should be like//var char_name1 = event.target.data.char_name_1;//var char_name2 =
I know that as long as a I declare variables inside a function I can only call them as long as the scope of the function is active. Outside of that function the variables don't exist. Is there any way I can create those variables inside a function and use them outside of it?
I'm using a few for() loops to populate my game. Now, I have 2 versions of each function, one that executes when my variable "debug" exists, and the other that activates only if "debug" does not exist.Looks kinda like this:
ActionScript Code: // first, if debug exists, the script will execute for the single instance of my movie clip "myBox_0". if(debug){ // assign a value to the string "myTarget"
[code]....
Now, on the line I starred*, if I enter "images/0" instead of what you read there, then it works. But when I try to use the variable "i" then it gives me the error "Error opening URL 'images/undefined.png'" I ran a trace statement to track "i" through the code and it works up until I enter the tellTarget statement... how can I get my script to pass that variable through that statement?
I'm pretty new to working wth custom classes, but so far everything has been working great - up to the point where I create more than one instance of the same kind of class. For example:
[CODE]...
Do I simply have to call the arrays different names??? I really don't want to, shouldn't by creating two different instances you subsequently create two different arrays in turn?
I'm currently learning OOP through Sen's information here at Kirupa, and I've decided to try out his "creatures" exercise mentioned in his Best of Senocular thread...The situation is a random number of sprites are created, and they move around the stage, interacting. They all have a certain amount of "health," defined as a variable in a MovieClip prototype applied to the MC. When they hit, I want their health to go down a little bit, so how can I access a particular MC's "health" variable while I'm outside of the MC itself?
Send Dynamic variables from HTML to Flash.e.g FlashVars="title1=Title1&img1=001.jpg&desc1=Descri tion1&title2=Title2&img2=002.jpg&desc2=Descriptio n2...";because the number of photos are not sure. is there any way to loop through those variables in flash and save them in Arrays
var q4:Boolean = false; //Will have thirty-eight of these, q4-q41
function noRepeat() { if (q(_root._currentframe) == true) { gotoAndStop(randRange(4, 41)); } else if ((q(_root._currentframe)) == false) { q(_root._currentframe) = true; } }
Now, my problem is the bits in red (yes, I know they don't work, that was just the best way I could think to describe what I wanted).
If I create a string that says "q4" then I find it won't compare that to the boolean variable, but I'm positive there must be a better way than putting one of these on every frame.
So, performance wise, is it necessary to null references to classes, etc inside a function? Something like: Code: function myFunction():void{ var myVar:myClass = new myClass(); //do stuff with myVar... //don't need myVar anymore myVar = null; //is this necessary? }
I'm currently learning OOP through Sen's information here at Kirupa, and I've decided to try out his "creatures" exercise mentioned in his Best of Senocular thread...I still have a bunch to learn, but I wanted to go ahead and ask a question for a problem I am having right now.The situation is a random number of sprites are created, and they move around the stage,interacting. They all have a certain amount of "health," defined as a variable in a MovieClip prototype applied to the MC. When they hit, I want their health to go down a little bit, so how can I access a particular MC's "health" variable while I'm outside of the MC itself?
I am trying to activate a rollOver-function when the mouse rolls over a movieclip inside of a movieclip.On the main window (root), first you rollOver a button where a window shows up with more options (movieclips).From stage, my first movieclip is called "catapultas_read_more" which leads to amother movieclip called "pic1_mc". The label that is going to play when mouse over on pic1_mc is "rollOn".I tried this.gotoAndPlay("rollOn); directly inserted to the movieclip, but the movieclip inside pic1_mc never starts