Actionscript 3 :: Changing The Value Of A Var Via Reference?

Aug 4, 2010

I need to pass a variable reference to a function, and have the function change the value of the variable.

So, simplified and not in completely correct syntax, something like this:

function replaceValue(element:*, newValue:String):void
{
element = newValue;
}

[Code]....

Of course, in the replaceValue function, element is a new reference to fungibleValue (or, rather, a new reference to fungibleValue's value). So, while element gets set to the value of newValue, fungibleValue does not change. That's expected but totally not what I want, in this case.

There's a similar question, for Ruby, here [URL]

As the question points out, Ruby has a way to accomplish this. BUT is there any way to do this in ActionScript?

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Changing Reference From Instance To Class?

Oct 14, 2010

i'm playing around with Senocular's brilliant transform tool. Here's the code that I'm having issues with - it targets the instance name, which is great and works perfectly.

ActionScript Code:
_transformTool.targets = [pasteBoard];
_transformTool.activeTarget = pasteBoard;

Here's the issue. When I have an MC placed on the stage with the instance name of 'pasteBoard' the above code (which tells the transform tool what to transform), works just great. However, when I place the MC on the stage with AS and name it, the transform tool can't find it . Here is the code I'm using to place the MC:

ActionScript Code:
var pasteBoard:_pasteBoard = new _pasteBoard();
addChild(pasteBoard);
pasteBoard.name = 'pasteBoard';
pasteBoard.x=128.00;
pasteBoard.y=300.00;

Now, surely this should work as I'm even giving it an instance name? But it does not, it does not work even with no instance name, or when the class object name is different than the instance name. Weird huh? Surely this should work just fine as I'm doing exactly the same thing as placing it on the main timeline, just doing it with code. But the transform tool, referenced by the code at the top of this post, can't find pasteBoard.

Do I need to alter the code at the top to find pasteBoard by class instance? how would I do that?

View 4 Replies

ActionScript 2.0 :: Changing Reference Point In Empty Movie Clips

Oct 23, 2009

I have an empty movie where I load some content (images), but i need the reference to be on bottom right of the content, while flash load the content with reference point at top left. I think that it is possible to change reference point with as2. Working with as2 and flash player ver. 9 on flash cs3.

View 3 Replies

ActionScript 3.0 :: Null Object Reference Error When Changing Scenes

Oct 20, 2009

I have an error that is not negatively effecting anything, but I'd rather fix it if I can. I have to do with "MouseEvents" when I change from one scene to the next. As in the objects do not exist in the "new" scene so there is a "null object referenced" error. The objects are not referenced in the new scene. Its a "mouseOver" and so when the scene changes and the "MouseOut" happens it tries to exicute a funciton on an object that is no longer available. I was thinking of changing the functions to "if/Else" statements, as in:
"if currentScene=X Mouse out, Else "NOTHING"

View 2 Replies

ActionScript 3.0 :: Random Error #1009 "Cannot Access A Property Or Method Of A Null Object Reference" - Even When Test Without Changing Anything

Mar 28, 2009

So I am loading clips and images into a swf file for a portfolio site. As I test the site to debug I sometimes get a #1009 error and sometime I don't. Even when I test without changing anything and go through the exact same sequence of actions to try and get the error again it only throws the error about half the time.

I don't understand why it would do this at all since the file works flawlessly sometimes so my code is accurate. Any ideas? I have heard about display lists before and wonder if maybe that might have something to do with but I don't know what a display realy is or how to make sure that things are on it... I'm confused. Here is the error it tosses: TypeError: Error #1009: Cannot access a property or method of a null object reference. at 00000schmackLabIndexFINAL_fla::MainTimeline/loadMask() at 00000schmackLabIndexFINAL_fla::MainTimeline/frame208()

View 5 Replies

Actionscript 3 :: Remove The Word Button From The Reference To Reference The Actual Item

Apr 11, 2012

I need to remove the word Button from the reference to reference the actual item that will be tinted.

[Code]...

View 1 Replies

ActionScript 3.0 :: Compiler Is Throwing That 1000: Ambiguous Reference Error For Any Reference ?

Sep 3, 2007

I'm having this frustrating error showing up and I have no idea why. Let me show you my classes and see if you can spot anything wrong.
First, here's my ILode interface:

ActionScript Code:
package com.schelterstudios.lodeSystem.flash.lodescode].....

So the problem I'm having is the compiler is throwing that 1000: Ambiguous reference error for any reference to instance.priority or instance.label. Why??? Instance is typed to IFlexLodeInstance, and IFlexLodeInstance lists method signatures of priority and label getters, and it inherits ILode, which lists method signatures for priority and label setters. What can I do to get the compiler to stop complaining?

View 9 Replies

Flash :: Reference The Default `this` Reference In Actionscript3 From An External Package?

Jul 7, 2011

My code is an external .as file. Google provides this code on their demo, which contains the this keyword:

[Code]...

Notice that I have 4 calls to console.log. The first 3 fire, but after the new GATracker statement, the 4th does not fire. I have a feeling that I'm overriding the entire package with the object created from new GATracker when I should be passing a different context. I believe the correct context I should pass is whatever this defaults to when not inside of a package/external file, I assume it references the main stage object.

View 2 Replies

Flex :: Create Weak Reference And Strong Reference?

May 6, 2010

package uk.co.bigroom.utils
{
import flash.utils.Dictionary;
/**
* Class to create a weak reference to an object. A weak reference

[code]....

In this Class, how they denote one as Weak Reference and one as Strong reference.

View 1 Replies

Flex :: Changing Cornerradius Of Label And Changing Arrow Of Combo Box

Aug 14, 2009

How do I change the corner radius of a Label component in Flex. Tried applying style name, and the setStyle('cornerRadius',9) methods, but doesn't work. How can I change the arrow image in the combo box control to a different image?

View 4 Replies

Duplicating & Changing Movie Clip Without Changing Original?

Aug 31, 2009

I want to create another button on the main menu of my flash site. I want to take one of the existing buttons (which are set as movie clips) and modify it to show a different menu name and page link. BUT when I go into my library and "duplicate" my movie clip, change the instance name, drag it to the stage and attempt to modify it, the original changes as well. I need to keep the original the same and create a new one with the same code, frames, etc but with different static text. I keep going in circles

View 1 Replies

ActionScript 2.0 :: RGB Changing Is Working But Not Changing All The Time

Feb 1, 2006

basically when you load the .swf it changed everytime u re-load it , i want it to keep on changing even when the user hasnt reloaded the image

[Code]...

View 1 Replies

ActionScript 3.0 :: Reference Between Two MCs

Oct 19, 2009

I have two MCs - main.swf and sub.swfIn main.swf I've created a loader object which load my sub.swf.How can I refer from sub.swf to loader object which is in main.swf?

View 1 Replies

Can Swf Reference Images

Jul 23, 2009

I'm trying to create a swf so it always pulls images from a folder (e.g., containing image1.jpg, image2.jpg, etc), so if someone needs to easily swap out images they can do it by simply replacing image1.jpg. Is this possible?

View 5 Replies

Reference An Object Itself?

May 5, 2010

I want to print the content of the label property in the Alert window.[code]...

But the Alert window is completely empty. What am I doing wrong ?

I guess the keyword "this" is referencing the application instead of the LinkButton, right ?How can I reference the LinkButton itself, without having to add an ID to all my linkButtons?

View 1 Replies

ActionScript 3.0 :: How To Reference The Mc Using +i

Jan 26, 2010

I have a loop that i need to go through a bunch of mc's names sequentially - panelq1, panelq2, panelg3 how to reference the mc using +i ?

ActionScript Code:
// Populate question 1
panelq+i.section_txt.text = quizXML.question[i].section;

View 2 Replies

ActionScript 2.0 :: Reference XML To Another XML?

May 29, 2007

is it possible to make an XML file reference another XML file? Like I have an XML like so:

[Code].....

how would I do that? or if that can't be done, any alternative method?

View 8 Replies

Reference Text With Variable?

Oct 20, 2009

I want to be able to reference the text of a text box within an MCThe MC is called "box1", the text field is called "field1"...I have many MCs (all with field1 in them)... box1, box2, box3 etc etcObviously I can set the text to being something by saying...box1.field1.text = "set_this_text"However, I'm using a variable to come up with the "box1" bit. (Using an array and a loop to figure out which box I want to update based on where the user clicked). So, let's say I have a variable... and I want to say..boxClickedon = box1 //will be defined by userSo I don't know in advance about box1... I can only access it through "boxClickedin" variable, but

boxClickedin.field1.text = "set_this_text"
or
[boxClickedin].field1.text = "set_this_text"

[code]....

View 1 Replies

Reference A Return Value Within This Package?

Nov 24, 2009

I am trying to understnd some of the things about packages, I have expand a book exercise and I am now trying to workout how to reference a return value within this package.I have put together this package

Code:
package classes
{
import flash.display.*;[code]....

What I am trying to do is use the 'return(spot1);' value where 'new smiley1(); is.My goal is to be able to create the library object name, (in this case smiley1 from a string variable and then display it on the stage with addChild.At this stage I am just trying to work out how to swap 'new smiley1' with the 'return' value.I will work on the addChild bit next.

View 2 Replies

ActionScript 3.0 :: Way To Reference Another Scene

Jun 21, 2011

I have on the first scene, which is named "Edicion", a series of input text fields, which is intended for the user to enter in scores for different teams.

Then there are different scenes for each team, which display their team flag and their score.

How do I, on loading of each team scene, reference the "Edicion" scene and grab the value entered their team score, to update the score?

I have tried _Edicion., _parent., and _root. and even just Edicion. but nothing works, I keep getting undefined.

Example: _Edicion.teamNameScore.text;

I know how to update the score on the current scene. But just can't grab the score entered on the default scene.

View 1 Replies

Locate A Reference To Movie?

May 14, 2009

Using flash CS3, how can I locate a use of a movie on the stage? I know if I can see it, I can click it to ID but that is the problem.

View 1 Replies

ActionScript 1/2 :: BlackJack Reference?

May 6, 2010

tell me any blackjack reference in AS2?

View 2 Replies

ActionScript 1/2 :: How To Reference To External SWF

May 30, 2011

I'm new round here so sorry to open with a question. Flash isn't my area  of expertise at all, but if anyone needs help with Photoshop or Joomla then I might be able to help! Anyway - my problem. I had a SWF which interacts with a component SWF. I want to remove the  component and replace it with an external SWF. I've created a SWF which  contained only the component. I'm then loading that using the following AS2 code:

Code:_root.createEmptyMovieClip("my_ssp", 1);
container._x = 0;
container._y = 0;

[code]....

View 6 Replies

Flex :: Cannot Assign To A Non-reference Value

Jan 22, 2010

I have a strange problem, I have a XMLList with elements who have the attribute position from 0 to x. When I want to add text to a element of that XMLList by the following statement, I get a error message:

textElements.(@position == columnIndex) = "anyString";

1050: Cannot assign to a non-reference value.

View 2 Replies

.net :: Add Reference To ShockwaveFlashObjects.dll To Windows App

Mar 8, 2010

I was cheating from a sample program to integrate with Flash. I able to add a reference to ShockwaveFlashObjects.dll to my windows app, but What is 1- AXShockwaveFlashObjects. 2- How to add a reference to it, or I have to create it using some tool?

View 2 Replies

Actionscript 3 :: Get An XML Object Reference Instead Of Value In It?

Nov 4, 2010

I need to get a pointer to a piece of XML. I can get a pointer to the parent node and everything works but trying to get a pointer to a node that has no children just returns the value of that node.[code]...

Tracing subNode would be just the value and there is no pointer to the original xml object, so editing the subNode var would only change its value, not the one in the original XML object.

How do I get a pointer to the subNode so it can be edited to change the original xml object?

View 2 Replies

AS3 :: Extract Class Reference From Swc

Apr 8, 2011

Does anyone know how to extract a class reference from an SWC file? I know I can right click / "Go to definition", and view the class definition. I need to extract these for each class in an SWC. Can anyone provide a method to do so automatically?

View 3 Replies

Actionscript 3 :: How To Reference Objects

Sep 9, 2011

[Code]...

I've learned it reading a tutorial over internet, but I want to know where I can find more samples on how to reference objects in AS3. For future codes, I want to add hitTest and the like.

View 3 Replies

ActionScript 2.0 :: Reference To A Value On Webpage?

Jan 13, 2009

I'm making a sports roster for my school's website and I want to use actionscript to save me time updating. Is there a way I can use actionscript to "reference" to a value (code)... on a webpage (url).. so that when the value is updated, it would reflect on my roster?

View 0 Replies

ActionScript 3.0 :: Get TextFormat Name (or Reference)?

Jan 15, 2009

Im new to As3 and theres an issue thats driving me crazy. I need to know the name (or reference) of a TextFormat and I cant seem to do it.

Heres some of the code

ActionScript Code:
var f:TextFormat=tf.getTextFormat();
trace ("f.size"+f.size)
trace("****** "+f as String);

Basically I need to find the name of the textformat, which when I created i named like this:

ActionScript Code:
// for example "menuTextSmall"...
var nombreFormato:String = formatosXML.estilo[i].@nombre;
global.formatos[nombreFormato]=new TextFormat();

I have my formats in an xml file with name, attributes, etc. I can get the properties of the TextFormat but I dont know which TextFormat it actually is!!

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved