ActionScript 2.0 :: Changin Global Var On Runtime From Within Button?
Apr 26, 2005
I've been playing with writing a simple script that would entirely depend on a few variables declared right on top of it. Is there a way of changing them (in my case values of p, q, a & b) with a button if the button is part of the script?Here's the script (just copy and paste entire thing into the first frame);
I've been playing with writing a simple script that would entirely depend on a few variables declared right on top of it. Is there a way of changing them (in my case values of p, q, a & b) with a button if the button is part of the script? Here's the script (just copy and paste entire thing into the first frame);
So basically i have a user class, which has a winsock class within, i when the winsock handles the connect event, i want it to change a text field on the stage to say "connected"somehow, i can't acess the root.net_status.text from within this class..the class is dynamic and public..but it keeps telling me "access of undefined property root."
i'm loading some videos in timeline, in different frames, using myFLVPlayback component.how can i make a GLOBAL on/off button for audio?the problem is SoundMixer.stopAll(); stops any video from playing.i want to see the video running, but not hear any sound
I have some filters set up, and have assigned some global vars to them, which I then use in my Filters code to display the filters: myText:Filters [globals.data.glow1, globals.data.stroke1, globals.data.shad1] Works perfectly. Now I want to assign a global var to each global filter var to determine if it should be shown or not. So...
Background; I want to load a global variable from a button action, and use this global variable to point to a frame named with what I'm gonna set the variable to, for instance a global variable of 1 will trigger a movie clip with a to play to a frame named 1.
I've set _global.x = 1 from a button instance withing an on(rollOver) block, and it shows up fine through trace(_global.x) from within a separate movie clip instance (within the same scene/timeline), but when I tried to use it in gotoAndPlay using the syntax gotoAndPlay(_global.x) it doesn't work. I'm sure I'm doing something wrong but I just don't know what.
I have a button, and inside the button, i have a dynamic text field that i want to display a global variable in the "over" frame. (when the mouse goes over the button)
Normally, to make a dynamic text field show a global variable, I put the dynamic text box INSIDE a movie clip, and then define the variable in the movie clip.
For example, i would put this into the movie clip containing the dynamic text box:
i defined the global variable in the first frame of my file, and i can access it on other frames, however i am trying to access it within a movieclip, and flash is telling me that it is undefined. does anyone know why this could be?
I want to make a button disabled if a datagrid is empty and it should be enabled when there is atleast 1 entry. The entries in the grid are made at runtime. I tried this this is the button: <mx:Button id="update" label="Update Contact" enabled="{isButtonEnabled()}"/>
And the function is defined as where dg_contact is the datagrid: public function isButtonEnabled():Boolean { if(dg_contact.selectedIndex==-1) { return false; } else { return true; }}
I have about 10 buttons in my flash game. (just SimpleButtons), and i want to change their colors in runtime.How can I do this? I need to change the color of the button rectangle, and the color of the text in the button. I can do this i think by converting all the parts of the buttons into movieclips and then refrencing those moviecips.tansform.colorTransform, but then i have to make a seperate movieclip for all 3 of the button states (normal, hover over, and click), right?
I am creating a set of buttons at runtime and I want each of them to have a different function.Roughly speaking I am doing something along the following lines
for(var i=0; i<howManyButtons; i++){ var sname = ["myButton"+i]; this.createEmptyMovieClip(sname, this.getNextHighestDepth());
and then I go ahead and draw the buttons using lineTo etc etc.My problem comes when I want to assign a different function to each of the buttons, still within the "for" loop, for example
this[sname].onRelease = function (){ gotoAndStop(i+2); varText = theText[i];} }
This doesn't work as the button function is still looking to see what "i" is when it is released, rather than having an absolute value for either of the parameters. How do I make each function unique and yet fixed?
I've seen the Loom project, but are there any alternatives that are more mature (and actively developed)? I am looking for something that would allow load-time weaving of pointcuts into existing binary code at runtime with the AVM2 runtime.
Does anyone know the code for finding the global positioning of X & Y co-ordinates of a click of a button which is constantly rotating, and then secondly the code for when you click on the button it displays a movie clip on top of it -(position of x & y when clicked) at the angle that you clicked it (so underneath the buttons are still rotating so other people can click them where they are)to explain the context, I'm trying to design a mock up of a circular interactive table when someone comes up to it and clicks on one of the buttons that are moving, it reads where the person clicked it and opens up a new box (movie clip) where they clicked it (at the angle) so its not upside down if you are at the topI've included my .fla file which shows the four buttons moving and a little diagramexplaining what I'm trying to do.
I've been into coding for about 5 years now, but I'm a recent convert to Flash development. One of the questions I have at the moment is, considering that SWF files can be run by either Adobe Flash Player OR Adobe AIR, what's the real difference between the two runtime environments? What API's and Objects exist in one environment, but not the other?
Basically what I'm more or less trying to establish is, when would I want to develop an SWF for AIR, and when would I want to develop for Flash Player, considering that Flash Player can also execute locally (providing support for creating "desktop applications")
I've got a project that has an FLV with cue points controlling when graphics appear in the swf file. The graphics are being loaded into empty movie clips via AS on the stage (everything is being loaded and unloaded into the first frame of the main stage). What the client wants is a pause button that will pause/play both the FLV and graphics being loaded in the swf.
Whenever I link a set of movieclips together with the bone tool which are inside a containing movieclip, and also set the type to "runtime" instead of "authortime", I get this error when published.
"Runtime symbols with skewed matrices should be wrapped in a movie clip" What does it mean? I need the type to be set to runtime so I can use scripting with it..
I've imported Excel values through XML file. I can already navigate to any XML value that I want (by trace()), but I want to operate with these values in my applcation. I can read the XML values, but how should I make them to be global, to have access to them and use them anywhere in the timeline, in different moviclips? Easy example of importing XML file and importing some xml value:
ActionScript Code: stop(); var myXML:XML; var myLoader:URLLoader = new URLLoader(); myLoader.load(new URLRequest("file.xml")); myLoader.addEventListener(Event.COMPLETE, processXML); function processXML(e:Event):void { myXML = new XML(e.target.data); var MyVariable = myXML.Data[0]; //for example Data[0] in XML file stores value "0,5" }
And now, I want MyVariable to be accessed from anywhere in application. In xml file, value stored in Data[0] was '0,5', so now MyVariable is 0,5 and I want to have access to this number. For now it is available only inside this processXML function, how to take MyVariable outside?
I realize that the issue of global variables has been discussed several times on this forum in the past. I have carefully read each one but I could not find any clear, definitive answers. Let me first give the basic idea of what I plan to do with Flash.
I will be simulating electrical, pneumatic, etc diagrams. I will, for an example, have a circuit breaker that can be clicked, thus changing its state from open to closed. Once this is changed, the flow from that circuit breaker will also be changed. This could all be accomplished inside of this file fairly easily, but this Flash file will be linked to hundreds of other flash files, each containing a unique drawing, but the variable for that circuit breaker, and all the other conditions need to be passed from drawing to drawing.
I have spent a lot of time researching online and browsing this forum, but I cannot find a solution to this problem.
Is there a way to do a global timeline stretch in CS4 ?
Basically I need to change the animation speed from 12 fps to 25 fps - but I dont wont the movie to play twice as fast, and I don't want to have to manually move each key frame to fix it because it will take forever!
I'm trying to get a value from a function which is a URLLoader COMPLETE event but even with declaring variables outside of the function will not allow me to get the value out. I'm stuck.It seems that the Asynchronous nature of Flash makes it impossible to get a value out: e.g. this works:
// Initialise a URLLoader to get XML data from XML file var myFPBLoader:URLLoader = new URLLoader(); myFPBLoader.load(new URLRequest("flightPlannerBoard.xml"));
I have a simple banner which rotates through three different movieclips. I would like to create a function on the main timeline that controls the length of delay for each of the clips.
So far this is what I have on the main timeline, which is a single frame:
i have a button, and i need to to see the volume to zero when this button is pressed, and when this button is pressed again, the volume goes back to 100
i have different pieces of audio all around my flash presentation so i just need a global volume that sets my volume to 0 and also to a 100 when pressing the button.
I'm an old C programmer been away from programming for years. Now we have a project requiring Flash and I've been elected. Just installed CS4. I have 16 panels in 4 sets of 4 that rotate left to right. (Big learning curve on that one - fading transitions in the right order...). Each panel must have a unique url when clicked. (16 urls).I've looked through many solutions, most of which seem unduly complex. I think that the simplest short of going to onRelease() with AS2 (Later I have to add mouseover changes in the graphics) is something like this:[code]I haven't found this solution out there. Is there a gotcha because the a#Link vars are accessed as global within the scope of handleLink? It doesn't feel right, but it works fine and 16 global variables doesn't seem too bad.