ActionScript 3.0 :: Values In Variable After User Contact Inside MovieClip
May 19, 2011
I want to know if I have variables inside amovie clip that get some values after user contact and I want to use this values in other frames in the main timeline.
I am trying to create a dialogue system for a game that references lines of dialogue to be displayed from an array.Example:
var myArray:Array = new Array("My name is David.","I am a noob at actionscript.");
This all works fine, but what I really want to do is have the name "David" be a variable so that the user can change. The issue is that the array seems to convert any string variables into their string value so when they are referenced they only appear as the initial value of the variable.
Example: var myName:String = "Empty"; var myArray:Array = new Array("My name is "+myName+".","I am a noob at actionscript."); //user does something to change the variable myName
[code]....
Output: My name is Empty.,I am a noob at actionscript.When what I want is for it to say: My name is Jones.
on my stage i have 24 instance MC Page created at runtime (when cliked the button execute 24 instance MC Page from the library). Each of those MC Page create an xml with infos (not important), this variable_XML created is nested inside each MC Page.. From my stage i want to call each XML from each MC Page for make 1 unic big xml, then send it to the server.
So from the main stage i created a button that call each xml of each MC Page (there is a definit number of Page only 24, no more, no less). So when the 24 instances of the MC Page are created I push there instance name inside an Array "Page_Array". Now in my function exportxml i use get ChildByName(Page_array[number]) for find them then i can apply my method to the according MCPage.. Until here no problem, trace(dispObject.name) work. but when i try to get my variable inside the MC Page : trace(dispObject.my_variableXML), it doesnt work..
here is my function (only 1 page for this example ):
function exportxml(evt:MouseEvent):void { dispObject=getChildByName(Page_Array[0]); trace(dispObject.name); //trace Page1 trace(dispObject.my_variableXML);// here it dont trace the variableXML } normally if i trace(Page1.my_variableXML); , it should trace "my_varableXML" no ??
I am brand new to AS3 and just about muddled through with AS2. I have a problem which should have a simple solution but everything I try gives errors.I had a load of buttons on the main timline which worked fine. I have moved a load of them into another movieclip called flyoutMenu. Now none work and I get the error:Error #1065: Variable about is not defined.This is the code stripped down to one button:[code]
im trying this every which way.creating global variables etc.I have a movie clip with a text area (lets call it txttest)there is text inside it which i want to send from this movieclip on the main frame to a text area (lets call that one txttestB) on the main frame. Whatever i try i get undefined in the text area on the main frame.I have tried this...
I have a Input text area set up for a contact form. I want the area to display "Email", and for the alpha to be 50%. When you click on the text field to put in your email address, I want the original value to be removed and for the alpha to reset to 100%. I've been able to accomplish this fine so far using the code below; the problem is that I only want the value to become blank again if the user hasn't entered in information yet (this way if the user wants to come back and change something, it won't all be deleted when the text area is clicked on). I tried using an "if" statement, but Flash seems to just ignore it and perform the function either way.
Here is the code that I came up with: email.text = "email"; email._alpha = 50; email.onSetFocus = function() { email.text = ""; email._alpha = 100; [Code] .....
I am creating a quiz and I set one quiz block with questions into a movieclip. When the person answers the correct answer I want it to add to a counter and pass that value onto the next movieclip. So movieclip one is added to the stage it does something then adds a counter. Then moves to the next frame and movieclip2 is added to the stage. It does something and add to the same counter variable from movieclip1. And so on and so on until no more movieclips.
I need to create a variable inside a MoveClip. The easiest way to do this is to click on a movieclip in the editor and just enter the actionscript on a frame, but because i'm doing this with dynamically created movieclips i need to do it with actionscript.
PS: I'm doing it for sorting purposes in a slideshow.
I have a movie clip that needs to load an outside Variable and I know how to do it if the Variable is in the main time line.
Main TimeLine: timedelay = 5; MovieClip timedelay = _root.timedelay
What I can not figure out is how to load a variable in a movie clip that is on the Instance of itself (not in the movie clip).
I am fine if I only use one instance of the movie clip at a time on the stage since I can set the Variable on the Main TimeLine into the movieclip (using .root), but this would not work correctly if I want two instances of a movieclip with differenct variables.
Right now I am having to make duplicate copies of a movie clip with different Variable names. I was hoping there would be some way where I could only use one movie clip and give it different variables.
I have a simple question about Variables in AS2, i have a feeling the solution is pretty simple. What i exactly need is a variable that has a movieclip's name stored inside it. I created a variable called cardType and stored the moviecip's name inside it. Now when i declare the Tween you see below and assign it to the variable cardType (which should be replaced with the movieclip's name), it does not work.
PHP Code:
var CardType; CardType = LondonQuestions_mc.redCard_mc; new Tween(cardType, "_alpha", Strong.easeOut, 0, 100, 2.5, true);
i'm referencing variable names and object names dynamically such as:[code]i have 5 balls (insert joke here) which get all the same functions etc so i wanted a way to avoid making 5x functions to handle each one of the balls. Now one function can handle all 5, etc.what i can't figure out is how to use this same set up to reference a variable or object name inside another movieclip. if i have another movieclip named "myParent" for example, i thought i could refer to it with:[code]but this doesn't work.
I have list that is generated from a database that when click it calls a seperate movieclip in the library called comments and loads data from the database in it. I the movieclip i have buttons that I am trying to pass the data to but it doesnt seem to be working.
I'm converting an old AS2 file into AS3 (and trying to learn AS3 at the same time).A movie clip contains a number of different animated sequences and buttons within the application trigger these different sequences.The buttons are functional only when an animation has completed playing.
In AS2, I achieved this with a var called _root.animating which was initially set to "false" and switched to true when the animation played and switched back to false at the end of the anim sequence. The buttons checked this var when clicked. Here is some of the AS2.[code]...
I have here a nice contact form. The only problem I got is that I would like to have the field names (name, e-mail, telephone), displayed inside the right field, (so when the user clicks inside, the text would disappear automatically) in stead of displaying the names next to the fields. My first tough was to write inside each field, in flash the field names, and it was ok for the first look. But the user needs to delete first the field names like "name" from the input box, in order to enter his own. How could I make these field names automatically dissapear when the user clicks inside a text box?
The code: stop();send_btn.addEventListener(MouseEvent.CLICK, submit); function submit(e:MouseEvent):void{var variables:URLVariables = new URLVariables(); variables.fromname = name_txt.text; variables.fromtel = tel_txt.text;variables.fromemail = email_txt.text; variables.frommessage = message_txt.text; [Code] .....
I have a working contact form (.swf) that doesnt work inside another movie. Alone it works, but when I call it in main movie with loadMovie it doesn't.
[URL]
I used files from Kirupa's tutorials, made by claudio and senocular.
the source files work perfectly when I upload them to my server - but when I insert the form into my flash website - I am unable to receive the contact email at all. The problem must be with the flash file becuase I have not altered the php (except to send to my email)
I am using Flash CS3 (but publishing for action script2) I have double checked all my input field sare named correctly with var_names that match the php code. The form fields have been created as a moviclip named "form" and the following action script attached:
So far I have created/hacked about some code for an infinite scrolling menu bar, and am trying to create the rollover and release actions for each menu title. After researching it seemed best that the buttons were made from movies clips as apposed to the 'button' type, but I am not sure if this is the case. The problem I am having is that I am unable to get the Contact movie clip to recognise the onPress or an onRollOver and I am not sure why. The .fla file is available here and this is the code I tried to get it to work.
Code: _root.scrolling_mc._root.menu_mc._root.contact_mc.onPress = function () { if(contact_mc.hitTest(_xmouse, _ymouse, true) ) { trace("Does this button work?!"); }
I also tried: Code: _root.scrolling_mc._root.menu_mc._root.contact_mc.onRollOver = function () { trace("Does this button work?!"); } I understand I am probably on the wrong tracks with the use of _root. but I need to somehow trigger the nested movieclips.
i have a simple matrix form that consist of 3*3 textfields. my problem is how to get the values that the user will enter into it by a loop, i mean not using a long way such:
How can I change the speed of a moving car based on values input by user? Also, how can I make Flash calculate values of a function based on those input values?
I'm currently underway in designing the UI for my game's level editor, I'm not using Flash's build in UI components instead I'm doing it from scratch using OOP.I want to have buttons, drop down menus, panels/windows that contain text fields and buttons.
At the moment I have the buttons down whenever one is created it is added to a static class's static array, and given a unique id number dependent on how many buttons have been created and added to the array so far.I figured this would be good as whenever a button is created I could apply an Event Listener looking for a MouseEvent.CLICK. Then just using the event.currentTarget.getID(), to find out what button has been pressed.
I'm about to start making panels/windows so the user can enter numerical values then submit them via a button, which will also close the window. I was thinking about doing more of the same and having static classes for each input type which lists all instances of that type of object.
i need to develop an image gallery that displays images based on certain values chosen by the user. Imagine two sliders such as "gadgets" and "cars". The sliders provide values from 1 to 10. The flash movie then generates a gallery based on those provided weights. The user may want more gadgets than cars or all cars or more cars than gadgets etc. Im a tad lost as to where i should start here...XML? MYSQL? should i start swatting up on AS3?