ActionScript 3.0 :: Call A Function And Run It With Specific Properties Depending On Which Button Is Clicked?
Nov 25, 2008
How would I do this in AS3? I want to call a function and run it with specific properties depending on which button is clicked.So how do the "_this" statement work in as3? in as2 I would write something like this and "this" would stand for the instance name:
View 2 Replies
Similar Posts:
Feb 28, 2009
I have a function that is called by a CLICK eventListener. I want to call the function as if the button was clicked, but it wasn't really clicked.
Code:
var tempEvent:Object;
tempEvent.target = printMC.getChildByName("print0");
buttonFunction(tempEvent as Event);
[Code]....
View 8 Replies
Dec 6, 2010
Is it possible for me to create a button that must be clicked 4 times within 3 seconds to call a function?
View 3 Replies
Sep 29, 2009
I'm trying to do a test on the length of a string and then call a function depending on the result. This is the pertinent excerpt from the fla file:
Code:
_loc4._comment = candles[_loc3].comment;
// I want to find out the length of _comment and call differently depending
_loc4.onRollOver = function () {
if (_loc4._comment.length > 0 && _loc4._comment.length < 60) {
show_comment(this._comment, this._x + this._parent._x, this._parent._parent._y - 50);
} else {
show_comment(this._comment, this._x + this._parent._x, this._parent._parent._y - 100);
}};
Basically I want to check the length (in characters) of _loc4.comment and if its under 60 call with an offset of 50 and if its not call with an offset of 100.
View 7 Replies
Mar 14, 2007
I'm loading in 5 jpegs from an external file using "loadMovie" and i have 5 corresponding buttons (1-5) to load them with.
I want to change the jpeg the button loads in depending whether a separate navigation button has been pressed -
i.e.
navigation buttons:
-motorbike pics
-car pics
-lorry pics
If a user clicked on "car pics" then the loading buttons 1 to 5 would load "car1.jpg", "car2.jpg" and so on...
similarly if the user clicked on "lorry pics", the same loading buttons 1 to 5 would load "lorry1.jpg" and "lorry2.jpg"
View 1 Replies
Mar 2, 2011
This time, my goal is, I want to jump to a specific frame, when a button is clicked.
For example,
When I push button1, jump to frame 55,
When I push button2, jump to frame 65..
Buttons are designed in one frame, at the beginning, together...
View 2 Replies
Feb 3, 2010
i need to know if there's a way to lock button symbols in a specific state once users click them? i have a series of 34 buttons, and they all contain an animated movieclip in their "over" state. problem is when i click on one, they play the "over" state very briefly again before my event happens, and it looks funky. any way to make it so once u click it, it stays in "down" state? i know using movieclips instead of buttons will resolve the problem but i'd like to know if there's a way to do it without converting them all to movieclips,
View 4 Replies
Aug 26, 2009
I have many buttons in a few movie files, i need to select a few of these buttons and store them in an array so i use....
var twocolourbuttons:Array = ["mybutton1", "mybutton23", "mybutton34"];
I then need to show a movie file if the button that has been clicked on is in the array. so something like...
if e.target.name is in the array show the movie twocolor.visible = true;
i then need to go to a certain frame of the movie, depending upon where the button is found in the array. So if the button is at position three of the array, i need to jump to keyframe 3 of my movie.
View 1 Replies
Dec 14, 2007
I calling a function using setInterval()... however, it behaves differently in IE7 and Firefox. It is working fine in Firefox but not in IE7.Can I use getTimer() to call a specific function in every 3 seconds...?
View 1 Replies
Nov 18, 2009
I'm working on making a nitrogen tank that inflates a balloon a little bit more every time you click the tank. How do you set it up to go to a specific shape tween each time it is clicked, and then have it stop and make a reset button appear?
View 2 Replies
Mar 29, 2010
how I can loop a specific bit of my movie until a specific link is clicked?
View 5 Replies
Sep 16, 2011
I'm trying to make a generic button to call an specific frame but when I'll try it with trace it works perfect... when I make a goto code on it it messes up my entire count....here is the code I'm using...does anyone know whats happening? how can I fix this? here is my code
[Code]...
View 7 Replies
Sep 7, 2011
I have a flash website that uses an XML player to play the artist's songs. The player works great. Now, I need a specific button in the flash document to call and play a specific song title from the XML list. The button I tried and that is showed in the flash code has an instance name of "santaBaby", calling a function I named "sampleSong1"Here's my XML playlist:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<jukebox>
[code]......
View 9 Replies
May 20, 2009
I am trying to run a function upon a button being clicked. I want that function to call a seperate function outside of the Click function. It tells me it needs an argument but not sure what argument to give.
[Code].....
View 2 Replies
Jun 16, 2010
How create baseurl function in flash and how i call that function in button script
View 1 Replies
Nov 14, 2011
I'm using this code to call a actionscript 3 function through javascript
[URL}
and I want to call the acrionscript 3 function from a javascript function, but not on a button action.
actionscript code:
//call to javascript
ExternalInterface.call("sendToJavaScript");
//call from javascript
[Code]....
View 2 Replies
Apr 26, 2010
I have a function set up to stop a timer internal function pauseTiming():void { timer.stop(); } how would I call that function when a button is pressed, say with an instance name PauseTimer? I would also need to call the function startTiming when the button is pressed a second time. (or create two buttons, start and stop).
View 4 Replies
Oct 19, 2010
I'm writing an app where I want to know which, of an unspecified set of buttons, the user is clicking.The actual location of buttons determined by previous user actions, so I cant use information like mouseX.You can see from the code the way I'm attacking this - trying to access the button based on its position in the display list of a container. Unfortunately this has always led to type coercion errors 0 - AS can't see that e.target is a DisplayObject.se has solved this problem.
ActionScript Code:
import flash.display.DisplayObject;
import flash.display.Graphics;
[code].....
View 2 Replies
Nov 11, 2011
I have these function which are called when the file is started. However how can I call it when I click a button:
function processXML(e:Event):void {
myXML = XML(e.target.data);
// after this executes you can call getXmlValues();
getXmlValues(nodeId,n,stopAtNumber);
} function getXmlValues(nodeId,n,stopAtNumber):void {
[Code] .....
View 10 Replies
May 30, 2003
I have a mc (menu) with 9 btns:
+ bnt01
+ bnt02
+ bnt03
+ bnt04
[Code]....
For each btn I would have to change set.RGB
creating a function so that I would have to repeat this lines for each btn?
View 14 Replies
Mar 1, 2011
I am currently developing a game in a school project using Flash CS4 and Actionscript 3.0. I have searched the web for assistance, but have come up empty. Here is what I am wanting to do...
I have a 3 by 3 grid on screen. Each block in the grid contains a movie clip with four targets which cycle through at 24 fps. Each target with have a different outcome depending on which frame the mouse is clicked.I do not want the animation to stop after the frame is clicked, however. There are several different types of targets in the game. Some add points, some subtract points, one target has the avility to freeze the animations for a set period, and another one is basically an instant game over. Being as how I could not find any aid via the web prior to this post, I am not even positive that this is possible to code in AS3.0.Does anyone know if this is possible, and if so, how would I go about coding it?
View 2 Replies
Feb 17, 2009
I have a swf file in which when a button is clicked it calls a function in a javascript file using ExternalInterface.call
Now everything works fine if all files are in one folder.
but now If a place the swf file in this location /assets/swf/test.swf and the java script file in this location /assets/scripts/test.js
View 1 Replies
Feb 27, 2010
Is there a way to add an EventListener to a button and make it execute some action when it is clicked without calling a function?
In other words if I have three different buttons and I want to make an action depending on what button was clicked, something like.
If button 1 is clicked do this, if button 2 is clicked do this, if button 3 do this.
I know a different action can be taken using an eventListener and a function assigned to each button but I'm trying to understand more about AS3.
View 5 Replies
Jul 9, 2009
I've got an SWF that'll be viewed via a webpage, that loads a choice of 7 different web pages/SWFs depending on buttons clicked.The problem is these files are quite big and take a good few seconds to load each, so for each SWF, I created a progress bar on frame 1, that then loads frame 2 (where all the code and content is) once it's ready. The code I used is as follows:[code]The problem is as you can see from is that it takes ages to load the loader! So I end up with a blankurl... screen then the loading bar, then the content. Making the loading screen pretty useless!
View 2 Replies
Nov 9, 2010
I have 4 arrays named array1 to array4, is there any way to reference them dynamically? What I mean is if I have for example
var currentValue:int = 3;
and I want to be able to access a specific array depending on that value, is there an easy way to do that in AS3?In as2 you could do something along the lines of
("array" + currentValue);
but that doesnt work in AS3
View 2 Replies
Feb 22, 2012
If you don't add an asset (text field, mc, btn etc) to the stage / create the object dynamically, is it possible for the asset to move x,y position or alter it's properties depending on the user environment? If so, what environments can cause this? IE what browsers, op. systems, player versions etc?
View 4 Replies
May 7, 2011
I need to make a function (inside Flash) that will let a swf find out what date it is (each time it is loaded from a server) and then - according to the date - display a frame designated to that date. Optionally, I could have the swf load another swf based on the date.Originally I had planned to make some php wrap-around that would do the loading of different swf's for me - but this is not an option since the swf may soon be uploaded to a server that I cannot feed with php-documents (I don't get access for that - swf only!)So now I must find a way to do this within the swf. But as of right now I am clueless.
One thing I did learn during my googling the past many hours is that the "Date class" in Actionscript is risky - in that it 'reads' what date the end user has on his/her machine. So in the event that some user has the date misconfigured that will screw up what my swf will display.Therefore I am hoping that I could somehow do a variation of php's "echo date" and get the date from the server - but inside Flash. And then have that bit of data call for a certain frame/scene/loaded swf.
View 6 Replies
Oct 4, 2006
I was wondering if nayone knows how to have an animation play depending on the day of the month it is. I am working on an advent calander for a client and it would be nice if an animation would play depending on the day of the month.
View 3 Replies
Mar 5, 2010
I have a button with the following code.[code]How can I trigger this function from another button without having to rewrite all the code ?
View 2 Replies
Nov 11, 2009
Is there any way to call the override depending on what value a var has?[code]...
View 4 Replies