Actionscript 3.0 :: Variable Doesn't Change Right?
Jan 7, 2010
in Document Class action script file I have the following variable
Code: Select allvar ballPointRight = new BallPointRight(ball,xDir,padScreen);
And then in BallPointRight action script file which is linked with BallPointRight movie clip I have the following code
Code: Select allpackage {
import flash.display.MovieClip;[code]...
So the line xDir = -1; doesn't change variable located in Document Class action script file even if if sentence is true... Is it maybe because it's number?
View 3 Replies
Similar Posts:
Oct 3, 2011
I'm trying to pass the contents of variable playnoyes to the long line of code below to decide whether or not to autoplay the flash movie, but doing it as I have below, the resultant line of code has the variable in quotes and therefore the code doesn't execute it as expected. My question is, how can I pass the variable so that the resulting line of code doesn't have the quotes around the variable value.
var playnoyes='true';
var testtext = "<script type='text/javascript'>AC_FL_RunContent ('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.[code]....
View 3 Replies
Dec 12, 2010
So basically I have a class which adds items and needs a drag and drop. I change the x value of the entire contianer class simply by this.x = something
By drag and drop all the items slide across the screen. When I trace the x value of the container class it has changed, but the x value of the items stayed the same (although their x value on the screen definitely changed).
View 1 Replies
Dec 3, 2010
Im really new to as3, and im just trying out some stuff, but i cant get a shape to refresh and change when i change its variable using a text field.If i change the text fields text before i test it, it works, but while its running it doesnt change it again.Btw, trying to change the stroke size.[code]i just want is so that when i change the strokeSize_txt text box, it will change the stroke for the shape.
View 2 Replies
Oct 10, 2008
I have been banging my head against a brick wall regarding the following problem which must be very simple to fix, just can't see the answer.I have a class assigned to a movieclip called canvas. The class is called drawClass. I have called the instance of canvas on the stage 'drawingCanvas'.When I trace "drawingCanvas" I get object drawClass] which is fine. Tracing drawingCanvas.name gets me the instance name 'drawingCanvas'.This is a String variable.Basically what I am trying to do is pass the MovieClip name to another class. In my example the class 'toolBar', which can then interact with the MovieClip.
The problem is passing 'drawingCanvas.name' results in a String, so I get an error saying :TypeError: Error #1034: Type Coercion failed: cannot convert "canvasArea" to flash.display.MovieClip.I can't for love or money find a way to convert a String variable to a MovieClip variable! I have the name of the MovieClip, I just need to tell the toolbar class. But I can't find a way of doing this as the instance on stage is an object of drawingClass, not a MovieClip (unless MovieClips with attached classes are not treated as standard MovieClips?).
View 9 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
Aug 25, 2010
I want to call a html page through flash passing a variable, and receive this variable by javascript in the html. I created the following code: Flash:getURL ("service.html?option=1","_self","GET"); Html:<script>var option = location.href.split("=") if (option[1]=="1"){...}</script> The html is correct (I think...), however the variable does not appear on the URL. The URL is shown as "service.html".
View 1 Replies
Jan 14, 2009
I'm creating a board game which has 3 variables, p1Move, p2Move and activePlayer.
p1Move and p2Move store the p1 and p2 location on a game board. activePlayer stored who's turn it is at the moment.
I am loading a value in from a text file which changes the value of move. This all works fine when i designate a player directly:
ActionScript Code:
p1Move = [insert variable name],
but i want to designate dynamically based on who's turn it is.
Something like this:
ActionScript Code:
_root["p"+activePlayer+"Move"] = Number(this.varAmount);
so that flash changes the value of p1Move (or p2Move depending on who's turn it is) to varAmount. varAmount is the variable being read from the textfile.
Hopefully that all makes sense. Basically i want flash to change the variable associated with the active player only.
View 9 Replies
Apr 2, 2010
I made a new symbol. The symbol name is button. And it's text is "Start Generator" - So this code:[code]Doesn't seem to change the text of the button to "You clicked it"
View 4 Replies
Jan 31, 2006
I have a symbol created out of a bitmap image. When I converted the "bitmap" to a "movieclip" object, I selected the center registration point in the dialog box. After the symbol is created an placed on the stage, I can seen the registration point at the center of the movieclip. Nevertheless, if I check the coordinates of the movieclip, it refers to the top left corner instead of the registration point. The most strange thing is that if I try to check the coordinates of the movieclip using Actionscript - something like trace("x: " + mc._x + "y: " + mc._y); - it do refers to the center point of the movieclip. So how can I have the coordinates during design time the same as during runtime? Why do I always have to refer to the top left corner and not to the ACTUAL registration point?
View 9 Replies
Nov 23, 2009
Flash CS3, AS 2.0 so I have an XML file containing the number 72, and this script:
Code:
var imageNumber = new XML();
imageNumber.load("imageNumber.xml");
Then later, this script:
[Code]...
The problem is, the variable doesn't carry into my second bit of code. I can add a button and use trace to display the correct variable in the output box, so I know it's getting into Flash. The problem is that it's not applying itself to the second piece of script. Triple checked that the code with by putting in the number manually and using a normal variable, only when I use the XML file as a variable does it refuse to work. I'm very new to Flash so sorry if I've left any important information out, but can anybody shed some light on this?
View 6 Replies
Dec 11, 2011
In other language I can use this kind of sentences:
[Code]....
How can achieve this? because the above code does not work.
View 1 Replies
Feb 4, 2011
My problem is that I am using a variable to identify an element section of the many galleries I have under the tag "galleryType" and nothing is returning for me to display. Am I searching for my galleryType the right way in my code or do I need to loop through my galleryTypes on my XML.
here is my xml code:
<My_gallery>
<galleryType Name="GalleryName001">
<images>
[Code]....
View 2 Replies
Sep 5, 2011
I created a simple form where someone enters their email address to be listed on a mailing list at constantcontact.com. For some reason, the content of the input text field where a user enters their email address isn't being passed on. I know the instance name of the field is correct because I created a duplicate of the form but instead of an input field I just created a variable with my email address and it worked. Below is the code for the form that doesn't work:
var myVariables:URLVariables = new URLVariables();
myVariables.llr = "xxxxxx;
myVariables.m = "xxxxxx";
[code]....
View 2 Replies
Jun 17, 2005
I'm getting frustrating Why in Gods name this example doesn work???kirupa2 loads kirupa1 in which is _gloal variable setup (_global._myVariable = "XYZ")After clicking on PLAY button trace outcome is undefined
View 6 Replies
Jan 6, 2010
I am trying to send a php variable with one field from mysql. When I print the php variable on my php page it outputs the field, but when I try to send it to flash it doesn't output anything.Here is my php script that tries to send a mysql field to flash and there nothing is shown. It works on my php page, it outputs the mysql field.
$product=$result['product'];
$pro=$product;
$pro = "&pro=".$pro."&"; //~ make it a flashable variable
[code].....
View 2 Replies
Jan 25, 2010
I have this script on an invisible button on a banner ad, but the client doesn't want the linked page to open in a new window, but rather load over the page in same window. How can I change the script to accomplish this,
link_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
navigateToURL(new URLRequest("http://www.sdesignsstore.com/store.html"));
[code]........
View 3 Replies
Aug 8, 2011
Is there a way to apply a renderer to a grid in a way so that it doesn't modify the values in the data provider? I have a datagrid and on one of its columns I have a customer renderer which overrides the set data function and converts the number value in the dataprovider to a word. My problem is that when I sort the grid by that column it sorts by the new value, whereas I want it to sort by the old value that was originally in the dataprovider. Here is my renderer:
[Code]...
View 2 Replies
Sep 13, 2009
I have a movieclip Planet which consists out of a backround (BG) and a mask (PMask). The mask will be changed during gameplay (I add shapes, then draw this to a bitmap and replace the shapes with the bitmap).But for some reason the mask doesnt change along with the mask movieclip(as if it makes a copie of PMask and uses that as the mask instead, so that every change to PMask isnt applied to the mask of BG)This is basically my Planet.as file (I removed the stuff that isn't related):
Code:
package
{
import flash.display.MovieClip;[code]....
I don't know why I would need the "cacheAsBitmap", but it doesn't seem to mask at all when I don't use it.
View 0 Replies
Feb 3, 2010
I'm having trouble with a script I'm writing and don't understand why. I have
[Code]....
on a a button that I have, but when i test my file and click on the button, it doesn't change frames.
View 4 Replies
Apr 15, 2008
I have a class file that contains a for in loop. basically there are 50 states (movieclips) on the stage and here is what I have:
[Code]...
I don't think I understand enough about arrays or for in loops to understand why this isn't working... it traces the array, but not statesArray[states], and it doesn't change the alpha of anything.
View 1 Replies
Nov 28, 2010
I run a demo code,it extends Sprite,like follows:
public class Vehicle extends Sprite{ protected var _position:Vector2D; public function Vehicle(){ _position = new Vector2D(); draw(); } protected function draw():void{ graphics.clear(); graphics.lineStyle(0); [code]....
I don't understand following code,because I only define _position and don't define position variable,why I can use position.x? x = position.x; y = position.y;
View 1 Replies
Nov 5, 2005
I have a movieclip and I load a png file into it. then I want to put an onRelease on it and this won't work.. my cursor doesn't even change into a hand... Am I missing somthing here?
[Code]...
View 3 Replies
Oct 8, 2009
The situation: - some radio buttons on the stage (design time, flash GUI) - A quiz class What I want: - create a RadioButtonsGroup in the quiz class (not with the flash GUI) - assign all the radios to that group (radio.group = myGroup) - respond to the CHANGE event It seems not to work. The group gets created (all the radios of that group are indipendent from the others on the stage), but it doesn't respond to the event.
View 1 Replies
Aug 2, 2009
I have several movieclips which name is assigned to the variable MoveN when clicked on. But moving them with MoveN variable doesn't work.
[Code]...
View 4 Replies
Jul 12, 2009
When a variable reaches 0 gotoAndPlay frame 4
ActionScript Code:
//Variable Name: ammo
if(_root.ammo = 0;
_root.gotoAndPlay(4);
Doesn't work maybe?
View 1 Replies
Feb 6, 2010
I using the SSP component, and I scripted a custom event for clicking on loaded images to go to the next image.This is working very fine except for that the hand-cursor won't show up on roll-over on the image.I'd like this to happen, but dont't know how to.This is ths scrip I use now:
listenerObject = new Object();
listenerObject.onImageClick = function(eventObject):Void {
my_ssp.nextImage();
[code].....
View 4 Replies
Aug 23, 2004
I have a swf with a movieClip with a button in it with the following code:
[Code]...
Now the shoppingchart.swf has a movieClip with the instancename "shopLine_mc" in this movieClip there is a dynamic textfield with the var called product. Now I'd say that if I press the button the shoppingchart.swf should load on level2 and show the text "single toothpick" in the textfield right? It doesnt... it does load the shoppingchart.swf but the dynamic textfield doesnt change.
View 2 Replies
May 6, 2004
i have a problem adressing or targetting a attached mc when i target de mc directly it works fine but when i try it trough a variable it doesnt recognise its path anymore??? hopefully a part of the code is gonna explain the situation a litle better... this piece works fine:
[Code]...
View 3 Replies
Jan 29, 2011
I recently made simple changes to a class file and a document class when I run on my PC it works when I upload to my host godaddy it doesn't reflect any change. I've tried several different browsers making sure to clear cache first but no change the only thing I can think of is that the server is caching some of the files. Do they do that? If so is there a script I can run to refresh the server cache?
View 3 Replies