Actionscript :: Passing Reference Types By Ref - Flex

Jun 30, 2010

I know that in C# when you pass an object (non primitive) to a method the following is true: A reference to the object is passed Changes made to the object in the method are reflected outside of the method. Also, you can pass a reference to a reference in C# e.g this.changeObject(ref myObject);, in which case: Changes to the object and also to the ref are reflected outside of the method e.g. myObject = new new List(); would change the passed objects referred location. Is this possible to do in Flex/Actionscript - can a ref keyword be used?

View 1 Replies


Similar Posts:


Flex :: LocalConnection Passing By Value Or Reference?

Apr 8, 2011

When using LocalConnection that have two SWFs talking back and forth to each other. Are objects passed by value or reference?

View 2 Replies

ActionScript 3.0 :: Passing MouseEvents Of Different Types To Same Function?

Sep 21, 2009

I was just wondering if there are any problems that could arise from passing MouseEvents of different types (i.e. MouseEvent.CLICK or MouseEvent.MOUSE_DOWN) at different times to the same function? I've already built my project, and it seems to function fine, I just want to make sure that I'm not setting myself up for some problems in the future. I understand it's probably not the "cleanest" or "best practice" to construct my project in this manner, but if it works...

A simplified example:
PHP Code:
// This is the function that I want to call from varying places with different MouseEvents and triggered by different event listeners
function myFunctionA(evt:MouseEvent):void{
[Code] .....

Actually, in writing that, I may have answered my own question, because it seems that myFunctionA is simply expecting a MouseEvent... regardless if that event is CLICK or MOUSE_DOWN or MOUSE_UP event, right? Now, a MouseEvent.CLICK may have different properties than a MouseEvent.MOUSE_UP that I can access within myFunctionA; however, that shouldn't matter to the function, or is my thinking flawed?

View 3 Replies

ActionScript 3.0 :: Passing Complex Types To Php With AMFPHP 2

Jan 13, 2009

Passing a complex type to PHP with AMFPHP 2. This 'sort of' works, sort of in that I can pass an AMF object to a service, and I can echo that object back to Flex/Flash, but I cannot access the contents of the object in PHP.

A simple service

[Code]....

We get null. - Now I am assuming this is some sort of serialization I am missing, does anyone know what it is?

Edit - also worth noting when passing an Array to AMFPHP I have no problems accessing the data

View 2 Replies

ActionScript 3.0 :: Converting Variable Types For Passing In A Function?

Mar 17, 2009

I'm trying to write a robust "eventMaker" function that I can run with arguments that will then create an event listener based on the arguments.

However, I can't seem to get it to pass the arguments. Functions are impossible to pass; it can't convert string versions back to functions, and passing the function as type :function just yields "function() function{}".

The same is true with strings and class definitions - if I want it to refer to an object in my other .AS file called "helloWorld", I can't make it think of helloWorld as anything other than a string or an object, and when I write commands based on it I get errors.

So how do I contain classes, functions, et al in variables that I can then reference again, in code, as those functions/classes? How can I convert a string value to something that the code will know is a reference?

View 3 Replies

ActionScript 3.0 :: Map Data Types To Custom Types?

Jan 24, 2012

Consider the following function:

Code:
public function foo(bar1:int, bar2:uint, bar3:String, bar4:Boolean):void{}

What I want is to have the different types of data represented by custom named types which are essentially representing the original data types. I other word, I would like to proxy the data types and have a valid function as following:

Code:
public function foo(bar1:PAR_Bar1, bar2:PAR_Bar2, bar3:PAR_Bar3, bar4:PAR_Bar4):void{}

so PAR_Bar1 would proxy the `int` data type, PAR_Bar2 would proxy the `uint` data type, so on and so forth.

The reason I need this is because I'm using a debugger with a GUI that can run methods and allows changing function parameter values in real-time, the issue is that the debugger can't tell me what parameter I'm changing, it only displays the data type of a parameter. So if I need to change 10 different parameters all of type int, the debuggers display all of them as int and not by their names.

I think that if I use proxy types I can easily differentiate between parameters.

So, my question: Is it possible to proxy data types? I mean map specific data types to custom data types that would represent the base data types?

View 2 Replies

Actionscript 3 :: Not Passing Number By Value, Rather By Reference?

Sep 27, 2011

I have this:

for (var i:int = 0; i < 3; i++) {
var newChoice:MainButton = new MainButton(function(){
trace(this["func" + i])} );
}

[Code]...

However, I get func3, which I assume is do to it finding the value of i. But shouldn't it pass by value since it's a number? How do I get the wanted result?

View 1 Replies

ActionScript 3.0 :: Passing A Reference To Class

Nov 12, 2009

if i have multiple movieclips on the stage and i am writing a document class and in document class i import another class and i need to pass these movieclips to that class.

View 1 Replies

ActionScript 2.0 :: Passing Arguments By Reference?

May 12, 2005

Is it possible to pass arguments "by reference" instead of "by value". I know it's possible in almost every programming/scripting language I came across until today, but I didn't find any hint for doing it in Actionscript For those who don't know what "by reference" means: If you want to pass a Number to a function, say

Code:
var mynumber:Number = 5;
calculate(mynumber);
and you change the value of the argument inside the function, e.g.

[code]....

then the call to calculate normally does NOT change the value of mynumber because you have passed mynumber "by value", which means the value of mynumber has been copied to the num argument. This means mynumber is 5 all the time.Now sometimes u want to be changing arguments given to a function inside the function, and this is where u will normally use references. Passing mynumber "by reference" would mean that after calling calculate the value of mynumber will be 6...I know complex Objects like MovieClips are passed by reference. But how to do it with simple DataTypes like Number, Boolean etc.?

View 3 Replies

ActionScript 2.0 :: Passing A Variable By Reference?

Aug 30, 2006

function foo(bar:Number){
bar = 5;
}

simple example. How do I pass bar by reference to change it's value in the function.

well at least in C++ it's called passing a variable by reference.

View 2 Replies

Flash :: Passing Parameters To A Function Reference?

Aug 17, 2010

I'm attempting to write a performance testing function that can take any function, run it X times and spit out how long it took that function to run in AS3. I've got it working just fine if a function doesn't take any parameters but it comes up with an error otherwise.Here's the code:

public static function testFunction(targetFunction : Function, object : Object, ... parameters)
{

[code]........

View 1 Replies

ActionScript 3.0 :: Passing A Simple MovieClip Reference?

May 3, 2010

I loaded a SWF and passed the reference to a Class called Portfolio:

Portfolio.as:

ActionScript Code:
package
{

[code]....

Now I keep getting one error or another. Right now, it's telling me:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

I tried extending the thing but then I got a: "1203 No default constructor found in base class" error I just want to pass a simple MovieClip reference from one class to another.

View 1 Replies

ActionScript 2.0 :: Passing Array Variables By Value Not Reference

Dec 11, 2006

It took me hours to figure our why this was returning the wrong value - when assigning one array to another it passes by reference not Value. I need a way to force it to pass by values. e.g. copy the existing array and have the second array reference it, so i am free to modify the first array without changing the values of the second.[code]From the example above You see that in Actionscript when assigning one variable to another it does it my reference not value. So when you chage the value of one array it changes the value of the other automatically.I need to have the "test2" variable reference the "test1" array only by value so if modify "test1" the values of "test2" won't be modified.

View 7 Replies

Flex Tree Node Types?

Sep 6, 2010

i have a tree of nodes that i dont want some type of nodes to appear in the tree, i can check the data on tree item renderer for each specific node type, so i have one type that i dont want it to be shown as tree node, like it doesn't exist.

if(this.data.type == TypeEnum.id){
this.visible=false;
this.height = 0;
}
else {

View 1 Replies

ActionScript 3.0 :: Passing Parenting MovieClip Reference To Button Event?

May 10, 2010

I'm trying to reference a movieclip that's been passed through the class primary function (constructor/instance, tried both) but can't get a button event instance to recognize it. Since the button's based around an event, I'm not sure how to pass the reference. I stripped a lot of the code, but left the function sctructure as the button events are tied into a dynamic loop structure, a main reason why I can't move the buttons to a different class.

The example looks something like this:
package {
import flash.display.*;
import flash.text.*;
import flash.utils.*;
import flash.events.*;
[Code] .....

I'm trying to figure out how to get the site_mc reference to the button event so it can trigger other nested movieclips inside it (gallery_mc, etc). If this were AS2 it'd be a piece of cake but now I have all these invisible walls for variable passing.

View 11 Replies

ActionScript 3.0 :: Passing A Stage Reference To An Object Placed In The Design View?

Nov 28, 2010

In a game me and a friend are creating, the levels are stored in MCs. In the level MCs there are several other MCs that the player should be able to interact with.

This means the objects in the levels need a stage reference. I can place all the objects manually and pass the stage ref in the constructor of the object's class, but this is a pain when the levels are going to be pretty big.

Is it possible to make sure that flash always passes a stage ref to the object even though it's not placed there by code?

View 1 Replies

ActionScript 3.0 :: Passing A MovieClip Reference To A Function In An External Class?

Mar 25, 2010

I want to create a MovieClip, pass this MovieClip to a function in another class where it will be modified.The problem is, when I pass the MovieClip as a parameter to a function and start making changes, the changes are only made locally. The "copy" of the MovieClip inside the function gets changed, but the "real" MovieClip back in my main game class remains unchanged. Here's the code from my Main class:

Code:
var resourceLoader:ExternalResourceLoader = new ExternalResourceLoader();
var myMovieClip:MovieClip;[code].....

View 4 Replies

Flex :: Listen To All Event Types Of An EventDispatcher?

Oct 6, 2010

In Flex, is it possible to listen to all event types of an object that's an IEventDispatcher? addEventListener's first parameter is the type, which is a string. In many cases the documentation is not clear what event type it fires. I'd like to attach a generic listener to inspect the events.

View 2 Replies

Flex :: BlazeDS Serialization With Complex Types

Oct 25, 2010

I recently came into a situation when sending a nested object from Java to Flex via a HashMap the Objects were null. More precisely:final Map< Integer, List<String>> tempMap = new HashMap<Integer, List<String>>();would send the keys as integers but the values were all null.But when sending the same with String keys:final Map<String, List<String>> tempMap = new HashMap<String, List<String>>();the objects came thru.Are there any restrictions in BlazeDS serialization when using complex types as keys?

View 1 Replies

Flex :: Equivalent Datatypes For Various Wsdl Data Types?

Apr 21, 2011

WSDL defines a number of datatypes supported by web service . Is there a documentation stating the various equivalents of those datatypes on flex side. In general for any language that we use to consume web service, how do we get to know the equivalent datatypes of the wsdl types.

One of the web service that I am consuming is returning base64Binary (an image binary data) , What is the equivalent datatype of this on flex ?

View 2 Replies

Flex :: Web Services - Consuming WSDL With Inheritance Types

Jul 4, 2011

General information:
I use Flex 4.5
I use FlashBuilder 4
I generate the WSDL using JAX-WS 2.2 (via a GlassFish 3.1 AS)
I want to have a web service that returns a list of clients.

In the Java code, I have a base class for a Client, and 2 extending classes:
public class Client {
public String getName() {
return this.name;
[Code] .....

View 1 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

ActionScript3 :: Flex - What Types Of SVG Gradient Fills Are Supported When Using The Embed Meta Tag

Jul 7, 2009

I've been trying to embed some svg files into an AS3 project using the Embed meta tag. For example:

[Code]...

However when displaying these files as Sprites only some of the gradients are surviving the embeding process. From what I've found simple (2 step) horizontal gradients seem to stand the best chance of being preserved, but sometimes other kinds of gradients are as well. In one case simply rotating an object 90 degrees causes the gradient to vanish when displayed in flash. Does anyone know a rough set of rules to use when creating svg gradient fills so they are preserved when rendered in flash? BTW: I used Inkscape to create the images in question.

Update: Bizarrely the solution to this seems to be setting the opacity of any object in the svg file whose gradient isn't displayed properly to a value below 1. Don't ask me why this works but it does. It does however have the unwanted side effect of the objects edges not being rendered as smoothly.

View 4 Replies

Flex :: Unable To Create A New Instance Of Type 'some Class'. Types Cannot Be Instantiated Without A Public - No Arguments Constructor

Mar 1, 2011

I have a class with constructor and overloaded methods in it. When i try to import that class using blazeds i get an error saying [RPC Fault faultString="Unable to create a new instance of type 'some class'." faultCode="Server.ResourceUnavailable" faultDetail="Types cannot be instantiated without a public, no arguments constructor."] How to import class having overloaded methods using blazeds

View 1 Replies

ActionScript 3.0 :: Passing Reference While Simulating "releaseOutside"?

Jan 12, 2010

I have a bunch of draggable clips that need a "releaseOutside" event. All of the "releaseOutside" examples I have found use a direct reference to the dragged clip and the event.target for the MOUSE_UP is the stage. I would really like to avoid hardcoding a listener for my stopDrag. Any suggestions on how to work around this?

View 5 Replies

Flex :: Passing Data Between Views In Adobe Flex (Actionscript)?

Mar 30, 2011

Ive read a ton of online tutorials about this and cant seem to get a definite answer...

View1.mxml
navigator.pushView(views.view2, {response:"BLAH"});
View2.mxml

[code].....

View 2 Replies

Flex :: Testing - Null Object Reference With Automation Enabled Flex-application At Preloader?

Jun 10, 2010

We are trying to automate our flex application. After adding automation libraries to our project we get the following exception:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.automation::AutomationManager$/addDelegates()
at mx.automation::AutomationManager$/addDelegates()
at mx.automation::AutomationManager$/addDelegates()

[code].....

We are using Flex 3.4 and maven2 to build the application.

View 2 Replies

Actionscript 3 :: Flex - Reference Flex Elements Added During Runtime?

Jan 17, 2010

I am having difficulty getting a reference to elements added after compile-time using the 'id' property. I have seen a few forum topics suggesting that this isn't possible, and that getting a reference to elements added this way is trickier, but never just exactly what that trick is. This code throws a fun little: Error: uncaught exception: Error calling method on NPObject! [plugin exception: "ReferenceError: Error #1069: Property canvas_tentpoles_0 not found on SGraph and there is no default value."].

[Code]...

View 2 Replies

Flex :: Passing A Value From One MXML To Another?

Jul 28, 2009

I am getting a value in a MXML... now i need to pass it to another MXML to invoke an event... how can i do it.

View 4 Replies

Flex :: Passing Array To Php?

Nov 1, 2009

I have a TextInput and a List in my application. I want to send the information written in TextInput and the names of the selected options from the list to a php file.

Following HTTPService sends the TextInput's text and the indices of selected items from list finely to a php file but the selectedItems is not working as i expected. It does not send the names of the selected items

<mx:HTTPService id="configureService" url="configure.php" resultFormat="text" method="POST">
<mx:request xmlns="">
<textInput>

[Code]......

View 2 Replies







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