ActionScript 3.0 :: Add A Textfield To The Stage That Stores An Int?
Mar 28, 2012How do you add a textfield to the stage that stores an int?
View 3 RepliesHow do you add a textfield to the stage that stores an int?
View 3 RepliesI have got the game fully working, although i want to add a couple of features, one of them being more laps to the track itself. At the moment the user can only go around the track once which gives him a lap time and the game finishes. Could someone give me some advice or solution on how to create more laps to this game? I suppose for me to do this i would think i need to create an array the stores the laptimes, and a counter that saves how many times he has crossed the line?
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
[code].....
Not able to load the swf mySlide is a variable which stores the slide numbers
loadMovie(mySlide+".swf",1);
In actionscript object class can act as a collection that stores key,value combinations:
[Code]...
I have 3 graphic objects (obj0, obj1, obj2) on the screen which the user may move with the mouse. I need the final locations of the object to be stored and next time the SWF is started, the objects to be placed where the user left them. For this purpose I use Shared Object into which I push all my objects:[code]function saveParameters is called by mouseclick on a button and check point 2 shows all the three _x coordinate correctly which means that the parameters has been wtitten to the disk.However when I restart the SWF, the first check point traces objects_parameters.data.parameters=undefined,undef ined,undefined.I.e. it cirrectly traces number of objects stored (three), but for some reason all these three objects are undefined and their _x and _y are not available.there a way to format AS code code here so that it will look like in my Dreamweaver to be more readable?
View 0 RepliesIf an object, or say... a document class, creates an instance of a class (and stores it as a variable), and it doesn't pass any arguments to the constructor of the class, can that class object, by simply having a function of it called by the parent, tell who sent it that command/request?
In other words, can a class object know who called it (such as it's parent) via a (seemingly) anonymous call?
I'm trying to create a global variable that initially stores a 0. Then via a function will change the value of that global variable, and allow the other functions to access the new number. I have it working where it adds 1 to the variable, and stores the number 1 however, I cannot get the number to add up beyond 1.
I have this in my first layer,frame.
_global.thisSound = 0;
function PlaySound(){
temp = _global.thisSound;
_global.thisSound = eval(temp) + 1;
}
Please note this is the basics of this function, there are other parts to the function for playing sounds, but this is the only part that I'm having the problem
Does anyone know where flash stores shared objects in windows vista? I've been looking all over for them and I can't seem to find where it stores them.
View 1 RepliesI'm aware this sounds quite involved, but would it be possible to make a Flash button counter that would store the number of clicks (that it displays) on a remote server; so even if the page was closed and re-opened it would still show "2" or "11" for example. In addition to that, would it be possible to only allow one click per IP address? So for example, one specific IP address (user) couldn't keep clicking it over and over and increasing the number.
The reason I wanted to use a Flash object as opposed to something like jQuery was because I want to embed it on a forum that isn't mine. Obviously I don't have access to the site's files/modules etc. Essentially it's almost like the Facebook "like button." It displays the number of likes, as well is storing the value on a remote server.
I would like to create a main menu and a hud within the application that stores and displays user information. Buttons like sound and main menu options should exist.. Now i cant seem to find any examples of how to create this user interface / hud.
View 3 RepliesI am creating an offline Flash Application which takes the user's photograph and stores it into a designated folder.My problem is how can i Store the photographs WITHOUT using any server side languages. (As its a standalone offline application).I know about the JPEGencoder classes and all.I can't use FileRefrence because it asks the user where he wants to store the image while i want to save the image in a pre-defined folder automatically.
View 2 RepliesI coming from an AS2 environment and trying to get my head around AS3.I have a dynamic Textfield on stage (instance name tfval)a movieclip named mcPlan, this contains a btn called s4.[code]
View 2 RepliesI have an addChild(tip);
but i want something like
if(tip == true){
removeChild(tip);
}
before the addChild(tip), in order to see if there is a tip, if there is i want to delete it and have the new tip added.
I am new to AS3 and trying to figure out how to set a focus to a textfield on the stage. I found out that if I use stage.focus = tf; then the tf get the focus and it does, when I type letters they go directly to this textfield.Problems are, I don't have a blinking cursor in the textfield. I added event listener to catch up when the user press the ENTER key but it catches the ENTER key ONLY after I click the textfield with the mouse and having a blinking cursor in that textfield.
View 4 RepliesI use this sample code taken from the docs: all the code is contained inside SocketExample.as, that is the DocumentClass too.
package {
import flash.display.Sprite;
public class SocketExample extends Sprite {
public function SocketExample() {
var socket:CustomSocket = new CustomSocket("127.0.0.1", 5000);
[Code]...
On the Stage i've a texfield named "text0", when i attempt to remove it throught AS3 writing removeChild(text0), flash give me an error(Error #2025). I always used this syntax for remove MovieClip symbols, why it seems not work for textfields?
View 5 RepliesSo I have this animation where listeners are added to movieclips on stage. The problem is that when I add textfields over the movieclips, the listeners no longer work. I highlighted the code in red where I add the textfields
Code:
var numbChildren:uint = this.numChildren + 1;
var txtInfocon5:String;
[code]......
I'm trying to access a text field from what I believe is called a sub-class. The text field is defined in the .fla file and the .fla file is set up to use Main.as as its document class.I got three files; scrollText.fla, Main.as and TextUtils.as.I know most of the code is working as I programmed it all in Main.as first, but when I moved the code to target the text field into its own class file I ran into error "1120: Access of undefined property" although I have declared the variable correctly and early enough to be used at this point in my code.This is the code I got so far:Main.as
Actionscript Code:
package{ import flash.display.Sprite; import TextUtils; public class Main extends Sprite public function Main()
[code].....
This is for AIR: My document class imports a separate class "ConnMonitor" and uses it to constantly monitor the network connection. It's at the very end of that class where it's supposed to update a textfield on the stage as the connection changes, but the class can't access the textfield.
View 8 RepliesIs possible to display all the information in the Output folder into a textField on the stage ?
I need to debug after publishing and I can't replace each single "trace" functon.
I have this so far.
function authcheck(evt:MouseEvent):void {
if (ID_input=="447839" || Password_input=="33227") {
gotoAndStop("authgood");
} else {
gotoAndStop("authbad");
}}
logbtn.addEventListener(MouseEvent.CLICK , authcheck);
It's probably not working because AS3 can't identify the "ID_input" input field. I have the two input fields on the stage with the instance names ID_input and Password_input.
I wanted to create an instance of a textField on the stage with simple text. I thought the following piece of code would work:
var textfield1:TextField = new TextField();
textfield1.text = "testing text";
textfield1.x = 300;
textfield1.y = 300;
textfield1.height = 150;
textfield1.width = 150;
textfield1.autoSize = TextFieldAutoSize.LEFT;
As far as I can tell the object is created and IS there but I have to call it somehow I guess.
I have:
- a flash movie with 300x20px dimensions
- a dynamic textfield
- xml data parsed into the textfield
Now I'm trying to scale the height of the movie/stage to the height of the textfield after the xmldata was parsed in. I've tried
stage._height = textField._height.
I have text field on the stage. How will I take it to the center of the stage? It's registration point is at the center that is why its going little away from the center.
Code:
a_txt._x=Stage.width/2;
I have a text caption (two textFields, one acting as a dimmable background and the second including the displayed text) that when added to the stage takes on the default alpha value (1) and is not changed when I address it in mouse_over and mouse_out events.Some background... What I want to accomplish is:
1) a horizontally scrolling image gallery
2) reads image source, caption title, link and page data from an XML file,
3) is re-usable on several web pages (both swf and xml) as it can identify the current page and dynamically display images appropriate to that page from the xml file
4) On image mouse over the image should resize (get bigger) and should pop up the text caption for the image (this is where I am stuck!!!)
5) on image click should take the visitor to a new url
I have cobbled this together from several tutorials and am not a developer.I sense I have gone terribly, terribly wrong with the textField stuff if not with other things too.The caption pops up on the stage at the bottom of the image (where it should be) at run time but at full alpha (1) even though I set it to 0 earlier.I suspect this means I am not loading these objects correctly (but I don't know where I've gone wrong).Then inside the MOUSE_OVER and MOUSE_OUT events I can't change the opacity attribute which makes me suspect I am not addressing these objects correctly (but I don't know where I have gone wrong here either).[code]
im struggling a bit with syntax here -- i'm trying to add a method to my multiplayer flash games then when an arrow hits an enemy, it will display the dmg, while scrolling up and dropping off alpha.I seem to be having some linkage problems this is what i have:
var dmgwin:dmgtxt = new dmgtxt() //movieclip that will contain textfield
var dmgwinsub:TextField = new TextField(); //textfield that has dmg #
var tween:Tween = new Tween(dmgwinsub, "alpha", None.easeOut, 1, 0, 2, true); //an alpha
[code].....
I want to make a input textfield and when you write something in it and you click a button it will appear random on stage.
View 1 RepliesI have an input textfield on my stage. I have created a AS3 Document as the Main Class for my work. Now I need to access the user input in the textfield and work with it in my class.
View 4 RepliesHow can I achieve this ? I tried
MovieClip(root),
MovieClip(parent),
stage,mytextfield.text = ... etc.
They all throw an null object reference problem.
I'm looking for a way to extend a TextField that's allready on the stage in Flash (AS3) something like this:
public class ChildTextField extends TextField
{
//code for childTextField comes here
}
I've placed a TextField with instance name 'thetextfield' on the stage. Now I would like to tell flash this textfield is of type ChildTextField. So in my Document Class I declare that textfield as a ChildTextField:
public class DocumentClass extends Sprite()
[Code]...