ActionScript 3.0 :: Make 1 Variable For A Textfield That Can Be Used In Multiple Function?
Mar 6, 2011
Some might know by know that I am working on a school project.But my knowledge of AS3 is not so big.My game is doing what it is supposed to do (for now).But the place where I declare (or something.It now looks like this:
Code:
public class game extends MovieClip
{
[code]......
View 2 Replies
Similar Posts:
Nov 25, 2009
I have 3 textfields, and an eventlistener for each textfield which looks like this:
[Code]...
View 1 Replies
Jul 30, 2010
I am trying to give a TextField a property such as:
Code:
field.debug = function(){ trace this.text; }
But it says: "cannot create property debug on flash.text.TextField"
What I want is to be able to make the 'this' keyword refer to the TextField. Is there another way of doing this?
View 6 Replies
Feb 11, 2009
i want to write a function that is used by multiple buttons and accepts a variable when it is called by a given listener..
ActionScript Code: this.fileBTN.addEventListener(MouseEvent.MOUSE_OVER, menuSet("fileMenu"));
function menuSet(what:String){
trace(what);//should trace back "fileMenu"
}
View 7 Replies
Sep 13, 2004
How do you make a variable have multiple answers attached to it?
example:
workPages = page2_mc, page5_mc, page6_mc, page7_mc
I tried this but it only used page2_mc and an array didn't work.
View 3 Replies
Oct 31, 2010
I am trying to make a simple mp3 player using flash. The songs are loaded using an XML file which contains the song list. The following code is inserted into a new keyframe.
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.events.*;
import flash.events.MouseEvent;
[code]...
The problem over here is in the nextSong() function. I am unable to preserve the value of currentIndex. Although I am incrementing currentIndex every time the function is called, but the value remains unchanged.
View 1 Replies
Jul 17, 2009
I have a number of functions in my code that I want to be called from a List Component, epending on what the user selects from the list. I've added a number of cities to the list like this:
Code:
combo.addItem({value:"akron",label:"Akron, OH."});
combo.addItem({value:"albany",label:"Albany, NY."});
[code].....
View 3 Replies
Apr 15, 2007
Why cant i make a variable in a function? like this:
aiBunny = function (target)
{
var target.hp:Number = 15;
target.interval = setInterval (aiFoe, 24, target);
};
View 3 Replies
Aug 13, 2009
I have a Flash file that has two music tracks. The player I built works well so far except for this, I am trying to make a Pause/Play button the works on either track. Right now it only works on one. With my limited knowledge of AS3 I tried different solutions but none worked.
Here is the SWF file; [URL]
You will see that the Pause/Play button only works on �Kiss My Dogg� which is track 1.
Here is the FLA file; [URL]
Below is some of the Script I wrote. The pause/play is the part I can�t figure out.
//function to load different tracks
function loadMusic(evt:MouseEvent):void{
//stop whatever is playing
SoundMixer.stopAll();
[Code].....
View 2 Replies
Nov 11, 2010
I have these images that will load when I input a certain string of text but I don't know how to combine functions to make a generic one that will work for all of the images. These are just two and they're basically the same thing except I have to make each function (something)1 and then (something)2 for the next image.
[Code]...
View 2 Replies
Apr 24, 2006
I have 4 buttons with instance names: 'alfa', 'bravo', 'charlie' and 'delta'. I want to make a function that runs on mouse click on either of the buttons. I tried this, but could remember exactly how it should look:
[Code]...
View 12 Replies
Dec 21, 2005
how can i make a movieclip and a textfield to resize to the content of the text in the textfield? I mean, if I have a textfield with 3 letters font name XXX and then the content of the field change, how can i resize te textfield so the text dont autoadjust to the 3 letter space?
View 3 Replies
Jan 29, 2012
I have a public variable and I am trying to set it, then read it from a different function:
public var str:String;
public function DailyVerse()
{
function create() {
[Code]....
My trace results says null. Why does it not give me "hello"?
View 1 Replies
Dec 2, 2004
how to make a function that will not lose the values of the variable before calling it and will not lose them after it is finished. example.
[Code]...
View 4 Replies
Jan 31, 2012
I'm still learning flash and actionscript 3 and i am having trouble with variable and object names. I need to be able to combine variable names together (in the same way as php can combine by doing var1.var2).
My swf contains 4 loaders (image1_loader, image2_loader etc..) which are a child of (image1_content, image2_content etc.....)
I then have 4 buttons which load an image into the loader and while doing so they define the currently active loader.
Finally i have 4 control buttons - scale up/down and rotate clockwise/anticlockwise which should only control the currently active loader (as set by the buttons above)[code]...
View 2 Replies
Jan 31, 2012
I'm still learning flash and actionscript 3 and i am having trouble with variable and object names. I need to be able to combine variable names together (in the same way as php can combine by doing var1.var2).
My swf contains 4 loaders (image1_loader, image2_loader etc..) which are a child of (image1_content, image2_content etc.....)
I then have 4 buttons which load an image into the loader and while doing so they define the currently active loader.
Finally i have 4 control buttons - scale up/down and rotate clockwise/anticlockwise which should only control the currently active loader (as set by the buttons above)
So my buttons as well as loading the image have the event listener:
image1_btn.addEventListener(MouseEvent.CLICK, setCurrentSelection);
image2_btn.addEventListener(MouseEvent.CLICK, setCurrentSelection);
(and so on..)
function setCurrentSelection(e:MouseEvent):void {
[Code]...
So within the rotateClockwise and rotateAntiClockwise functions i need to be able to recognise which is the currently active loader and have that number instead of the X - so if it is image1_loader - it needs to be image1_content, if 4 - image4_content... I had tried to do it as this but it doesn't like it being a string:
rotateAroundCenter((activeLoader+'_content'), 10, ptR);
View 3 Replies
Jan 31, 2012
I'm still learning flash and actionscript 3 and i am having trouble with variable and object names. I need to be able to combine variable names together (in the same way as php can combine by doing var1.var2).My swf contains 4 loaders (image1_loader, image2_loader etc..) which are a child of (image1_content, image2_content etc.)I then have 4 buttons which load an image into the loader and while doing so they define the currently active loader.Finally i have 4 control buttons - scale up/down and rotate clockwise/anticlockwise which should only control the currently active loader (as set by the buttons above)So my buttons as well as loading the image have the event listener:[code]So within the rotateClockwise and rotate Anti Clockwise functions i need to be able to recognise which is the currently active loader and have that number instead of the X - so if it is image1_ loader - it needs to be image1_content, if 4 - image4_content.I had tried to do it as this but it doesn't like it being a string:[code]
View 3 Replies
Mar 7, 2012
how you would target a function's local variable through a concatenated variable string.For example:
var txt = "Hello World";
function testing(msg) {
var test1 = msg;[code].........
I'd expect the trace to be "Hello World" but rather is given "undefined". So if variables created outside functions are created on the main timeline, where are local function variables created and how would you access them?
View 2 Replies
Jul 28, 2007
I'm trying to combine PHP/SQL and Flash. I've got a problem now. I want to load a variable that contains an url to an image. so the variable is like this: [URL] Now I want flash to load the image, not the text. The variable is called 'img1' but the loadmovie function doesn't work when I put it in.
View 2 Replies
Nov 24, 2010
I want to monitor a variable. Whenever the variable value changes I want to call a function. In actionscript 2 I can use "watch" but in as3 what can do ?
View 1 Replies
Nov 27, 2009
I have a set of Cue Points in an FLV I'm playing. It's an interactive quiz, so the idea is that flash will change a variable, theAnswer, to a different letter depending on which question it is. The answer to question 1 is B, question 2 is D, etc. Either the cue point event listener isn't working, or else it is working and Flash isn't declaring the variables. 1120: Access of undefined property theAnswer. I literally can't find a single problem with my code. I have an almost identical Event Listener further down which works.
[Code]...
View 4 Replies
Jul 27, 2009
is it possible to declare function this way
ActionScript Code:
function startShake(e:MouseEvent, num1, num2):void
what i mean is it possible to send to the function not only en event but also a variable and a second question how can i access
ActionScript Code:
function stopShake(e:MouseEvent):Array
this array that function return.
View 1 Replies
Oct 16, 2010
The Idea is i want to make avariable that stores his value after i close the swf and open ti again,
an example:
i make acounter
var i:int = 0;
var timer:Timer = new Timer(1000);
timer.start();
[Code]....
the value of i will increase but after i close the application and open it again the value will return to 0 , keep the variable stores his value after closing the application ?
View 3 Replies
Jul 19, 2006
I'm trying to achieve something i thought would be extremely easy, but i can't get it to work!
[Code]...
View 1 Replies
Sep 16, 2009
I need to pass a variable to a function inside a function. However this parameter (i) seems not to be passed (to function ...onRollOver). This is required to attach a textfield to a movieclip (reading the adress and showing it as a tooltip).
ActionScript Code:
for (i=0; i<array_BE_ElecCities.length; i++) {
var attachElecCity = mc_map.mc_places.attachMovie("Plant",
[code].....
View 1 Replies
May 5, 2011
I want to create a vector, then call a function that populates that vector with arrays. Fine. The only catch is the function itself will declare new array variables to put into the vector, but are these new array variables private to the function only?e.g. something like this
ActionScript Code:
public var vec:Vector.<Array> = new Vector.<Array>();
private function populateVec():void {
[code]....
Is this "kosher"? a was declared in the private function but added to something outside the function..?
View 4 Replies
Nov 22, 2010
I'm currently having a fair amount of trouble doing something that in it's concept is quite simple but appears to be hard to make happen.I am hoping to check a textfield, whatever is in that text field is then used as a variable to set another textfield, for example:
ActionScript Code:
var Na = 23
var C = 12
[code]......
View 2 Replies
Aug 7, 2009
Basically here is what I want to do[code]...
But I got something wrong in the declare statement.
View 1 Replies
Mar 25, 2009
I want to display some variables(cat1, cat2 and cat3) in a textfield(content_txt).I'm using a external AS-file.
I now have this:
code: //vars instellen
//titels
[code]....
View 1 Replies
Jun 3, 2010
I'm using createTextField to create a textfield. I have also created a input textfield with a variable called textline1 (I don't create the inputfield with as).I want to display the letters in the created textfiled that I'm typing in the input field. So this in my AS coed:
_root.createTextField("text1",1,100,100,300,100);
text1.variable = textline1;
format1 = new TextFormat();
[code]........
View 3 Replies