ActionScript 3.0 :: Referencing Variable Result Inside Speech Marks?
Jan 1, 2010
How would I go about refferencing a variable and then turning it into a string (if that is the correct terminology). e.g:
[Code]...
I need the result of variable something to end up inside the speech marks without loosing its obvious refference to the variable.
View 2 Replies
Similar Posts:
Jun 24, 2006
I am using ASP create XML file, than load XML to Flash.But just found a problem, some speech marks cann't be displayed.my XML looks like that:
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<config>
[code].....
View 1 Replies
Aug 1, 2010
I have a noob question about arrays.I have two arrays:
var array1 = new Array();
array1[0] = "1";
array1[1] = "7";
I know that these are in string format, but this is necessary for the whole code (i think!) but I want to be add these to values together, to get the value of 8, however if you do:
var answer = array1[0] + array1[1];
Then it just joins the 2 values to give 17, however if you times them, it treats it like a number.Is it possible to add them to get the value of 8 in another way without having to remove the speech marks from the array value?
View 2 Replies
Apr 27, 2010
ActionScript Code:
function setUpButtons() {
var btnCnt = numeri_array.length;
for (i=0; i<btnCnt; i++) {
[code]...
i'm having a problem with this script... the onRollOver and onRollOut are working properly but the onRelease it's always the same i mean (my_mc.loadClip(foto[27], "container") for all the 27 buttons..
ActionScript Code:
for (i=0; i<btnCnt; i++) {
var temp = this["a"+i];
[code]....
and everytime i have to make a modify i have to write for every case..
View 2 Replies
Feb 19, 2005
I've been trying to add quotation marks to a variable for the past hour or so, but I haven't been having much luck. Basically, here is what I am hoping to create:
Code:
blarg = W71;
temp = magic code that I can't figure out
trace(temp); // displays "W71"
I stumbled on a previous case of this [URL], but that method didn't work for variables when I tried it. Adding a + symbol before and after blarg gave me an error.simple way to incorporate quotation marks around my variable?
View 6 Replies
Jul 28, 2011
I have made a class that Pops-up a window that contains a panel with a textbox and two buttons, one for accepting, other for cancelling. It should work as a prompt in which you enter some text, and then if you like the changes, you accept, else, you cancel and the text you entered is discarded.
The thing I'm not sure how to handle is how to receive the text, once the user presses 'Accept', from the class I want to receive it from.
So, the approach I took is a bit cumbersome: firstly, when launching the popup, I associate with it a function (called onResult() in the code) from the 'class that launches', which will be called after the user presses the 'Accept' or 'Cancel' buttons; secondly, to get the text that the user inserted in the box, I keep a reference to it public from my class.
have a look at the code here: [URL]
I've also programmed in Android before, and the approach there would be much cleanier, just putting the text result from the popup inside a bundle inside an intent, and receiving it from the launched class. Here, I have to pass functions and such, which I don't like at all (although it works!).
View 1 Replies
Dec 20, 2011
basically I have an array that stores some var(int/numbers). And when I loop through the array changing the numbers of the var, at the end the number seems still unchanged. You would have a better idea of what I'm talking about base on the below code.
private var _numArray:Array = new Array()
private var _no1:int
private var _no2:int
[Code]....
View 2 Replies
Sep 1, 2010
In the following example (yes, I am coding on my timeline while I try to work this out - I know, I know) I am loading an SWF in an HTML page and then directing the SWF to get the query parameters from the current URL. The query parameter will contain the source for the video to play.
This seems straight forward to me but I cannot get myURL = urlVars.videoloc; to work. More specifically, urlVars.videoloc seems to be undefined rather than holding the query parameter from the URL. All other variables are correct; both wholeURL and urlVars are defined.[code]...
View 1 Replies
Nov 11, 2005
I ve a bit of missunderstood about functions: as i read the functions works:
basically 2 types:
named (can be lonely)
unamed (need and object)
- can i define a function wherever i want? ( _root, MC...) and call it from everywhere?, before or after i created it?
- if the variables of a function are local variables of that function. How can i store the result of a calculation of the function, in a variable outside it?
View 9 Replies
Feb 21, 2009
I am currently connecting to a PHP string in actionscript. While I'm having no trouble importing the variables like so:
Code:
this(variable);
I am having trouble referencing the same variable while inside a function:
Code:
_root.ButtonMovie.onRelease = function() {
this(variable);
}
I really need to reference the variable while INSIDE the onRelease function, because I need to apply some actions based on how many times the button has been pressed.
View 2 Replies
Feb 1, 2009
and I'm trying to add an event listener and a function to the class, but I keep getting errors of undefined, I tried just about everthing to be able to refference obj0
objGroup.obj0.addEventListener(MouseEvent.CLICK, onClick)
private function onClick (event:MouseEvent):void{
trace ("Click");
}
View 17 Replies
Dec 16, 2010
I am trying to reference a movieclip located inside an array to add an eventlistener and function... I am using array[0].add...ect. The code for the first movie clip works, but for the rest I get an error 1010.
Code: Select allvar image:MovieClip = new Image();
addChild(image);
const MAX_ITEMS:uint = 6;
[code].....
View 1 Replies
Jun 18, 2011
I understand this, _parent keywords and its usage but I don't understand the following:
MovieClip.prototype.move = function() {
function toRight() {
this._x=50;
[code].....
View 3 Replies
Nov 20, 2009
I have a bunch of objects with TextFields in them that are added to another object called Field.[code]If it is a player, and I can scale it, why can't I access the textField?
View 1 Replies
Feb 2, 2011
I am trying to enter a student name into a textfield (student1_txt). I just can't seem to work out the correct syntax. The student numbers and names are in an array. I have the fields working fine outside of the movie clip but not inside.
I wonder if anyone can see what is wrong in the statement below:
_root.desk1_mc["student"+heidedata[0]+"_txt"].text = myStudents[0];
View 8 Replies
Oct 20, 2010
I'm trying to set something up that will print a bunch of boxes on a grid in a certain pattern, and set things up so that a path can be determined from the start to the end. Each grid square is a MovieClip with an instance name x0y0, x1y0, etc. for each coordinate of the grid. I want to set a variable in my grid square class to 1 or 0, depending on whether or not a box is in that square. So I have this code:
for(var j=0; j < row1.length; j++)
{
for(var i=0; i <= row1[j]; i++)
[code].....
View 3 Replies
Jan 11, 2007
I have a simple function that dynamically creates text fields. My text field name is referenced by var thisTextField. Problem is, when I try to do things with my text field, actionscript shoots back an error as such: There is no property with the name 'text'. How am I supposed to apply properties to my object if my objects name is a variable?
Code:
function showProducts() {
var products:Number = 0;
var thisTextField:String = "product" + products + "_txt";
for (var itemID in _global.rtsData[_global.rtsPos]["products"]) {
[Code] .....
View 2 Replies
Jun 14, 2007
I am in no way very knowledgable with ActionScript, so this might be very simple and I am looking in all of the wrong places... but basically here is my issue: Instead of accessing an objects attributes like this, _level0.thumbnails.thumbnail0._width = 500; I want to be able to access it with _level0.thumbnails. (this.id) ._width = 500; where as (this.id) is a variable that could be equal to "thumbnail0" or "thumbnail99" depending on which object gets clicked. I have everything working to if I hardcode thumbnail0 it works fine, and this.id does get set to whatever thumbnail I click's "thumbnail" + ID
View 2 Replies
Mar 16, 2010
First off I want to say that the resources on this site have been excellent
how to reference a variable when adding a new Movieclip?
Currently I am using this method:
Code:
var myVariable:String = "one"
if(myVariable == "one"){
var myMovieClip = this.addChild(new one())
[Cde]....
View 2 Replies
May 2, 2005
fairly simple question (with a long explaination). I have an array, created from the results of another array and it's position in that array. There are actually multiple arrays It can be created from.
Eg.
Array1: clientName1, clientName2, etc.
Array2: clientType1, clientType2, etc.
Second Array: [clientName1,0], [clientName2,1] OR [clientType1,0] etc.
[Code]...
My issue is, I would like to be able to dynamically adjust the array that it is generating from. This would mean changing the bold bit of the code above. I have tried declaring a variable (type = names+"[i]") and using it in the linkArray declaration, however it will not see this as an array reference, only as a variable. What I want to know is, how do I reference the name of the original array as a variable so I can update it dynamically?
View 5 Replies
Nov 22, 2009
On the main stage I have a button that I have made invisible once the file is loaded. Inside a movieclip I have on frame 15 the following actionscript 3 code
button_mc.visible = true;
I want the button to become visible at the end of this movieclip. I am not using an external as3 file, I am putting the as3 code in its own layer on the first frame.
I know it has something to do with the path to the button, but I cannot figure it out. If there is anyone who can point me in the right direction for referencing instances by instance name that reside on the main satge from inside a movieclip
View 3 Replies
Jun 2, 2009
I have been using this line of code to fade in a movie clip:
new Tween(background_mc, "_alpha", None.easeNone, 0, 100, .5, true);
Now, I want to accomplish the same thing, only this time by using an element from an array (bg_array[currentSlideNumber]) that stores the instance name "background_mc"
I've tried the following, but it doesn't work:
new Tween(bg_array[currentSlideNumber], "_alpha", None.easeNone, 0, 100, .5, true);
View 3 Replies
Jun 15, 2009
This is a problem I thought I understood and was addressed in a previous thread [URL] but I have a new situation where the old solution isn't working.I have 3 instances on a "nested" movie clip. Their instance names are: b1, b2, and b3. When I trace these movieclips from the main timeline, I get:
trace(b1); // result = _level0.slide_mc.newMC.b1
trace(b2); // result = _level0.slide_mc.newMC.b2
trace(b2); // result = _level0.slide_mc.newMC.b3
From the main timeline, I want to fade up these movieclips using tween, but I need to do this by building the instance name in a variable:
var myInstance:String = "slide_mc.newMC.b"+ instanceNumber //(instanceNumber is equal to 1, 2, or 3)
Now, I thought using the variable in this manner would work:
new Tween (this[myInstance], "_alpha", None.easeNone, 0, 100, .5, true);
...but it doesn't.
I've checked trying to use the actual movie clip instance:
new Tween (this.slide_mc.newMC.b1, "_alpha", None.easeNone, 0, 100, .5, true);
...and it works fine.
View 2 Replies
Apr 19, 2011
I've got my variables set out in a layer on the main stage. I've also got a MovieClip which I want to write some code within but reference a variable in the main frame. I tried just referencing the variable name but it didn't find it. I then tried root.variable name but I'm now getting this error message:
ActionScript Code:
Symbol 'character', Layer 'CODE', Frame 1, Line 2
1119: Access of possibly undefined property deathReset through a reference with static type flash.display:DisplayObject.
View 9 Replies
Nov 5, 2009
I finally got the variable referencing between classes and custom event problems sorted out. Now I got a question regarding the Error #2044 and Error #2035. The error reads like this:
Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
I've put all the swf in the same directory, so I don't think that is the problem. Could it be that my XML file is in another directory that's causing the problem? I also heard having quotes in the URL in the XML file could also be problematic. Is that true? Here are my AS and my XML file.
[code]......
View 12 Replies
Sep 2, 2010
I am having problems referencing a variable on the main timeline in a .as file using root.variable.
[Code]....
View 6 Replies
May 25, 2005
I'm trying to reference an instance through the use of a variable in my call to a prototype. The variable is myVar and contains the instance name to which I want to apply the resizeTo prototype. My syntax is incorrect.
Code:
on(release){
//disregard this line
this.swapDepths(this._parent.getNextHighestDepth());
//this is calling a prototype named resizeTo
this.resizeTo(150, -100, -100);
//Setting instance name of another movie
myVar = "green";
//Trying to drop that instance name into my next prototype call
this._parent.myVar.resizeTo(100, _parent.old_X, _parent.old_Y);
}
View 2 Replies
Jan 25, 2009
Is there a way to reference multiple movieclips using a single variable name? For example,I'm making a side-scrolling game, and there's going to be many platforms, and I have some code that tells the player not to fall through these platforms, but I don't want to copy and paste the same "platform" code every time I add a new platform.
View 3 Replies
May 23, 2008
I am trying to load an image in to a dynamically created movieclip, which is:
_root.mySlider."+stripX2(band[i][0])+i
but I can't seem to reference it. I can load the movie into _root.mySlider, but if I add the dynamic element (stripX2(band[i][0])+i) without quotes it it doesn't load. If I load with quotes i.e.
"_root.mySlider."+stripX2(band[i][0])+i
flash doesn't allow strings in movieClip variables.The code I'm using is belowm, it's the second to last line thats causing the problem:
var loadListener:Object = new Object();
loadListener.onLoadComplete = function(target_mc:MovieClip):Void {
trace(">> target_mc._width: "+target_mc._width);[code]......
View 2 Replies
Dec 8, 2011
In my AIR application, I try to dispatch a custom event from a class to main window.This class is use to call httpservice. My goal is to send a custom window when the httpservice result is send.[code]...
View 1 Replies