Flex :: Referring A Component Id Throw A Variable?

Sep 7, 2009

I'm developing a flex application and I want to access a component by using it's id.
I know I must use .property of the component. The problem is I have the component Id in a String var and now I don't know how to access to it's properties.

View 2 Replies


Similar Posts:


ActionScript 2.0 :: Drag / Throw Component Disables Buttons?

Feb 20, 2005

I have buttons on my main timeline which calls a MC using attachmovie(). I have placed an EmptyMC on my main timleline for the MC to be inserted. Now, this particular MC has buttons on it which work fine. However, when I add a throw component onto the EmptyMC, which basicly lets me drag/throw my attached mc, the buttons are disabled.[code]...

View 5 Replies

ActionScript 2.0 :: Drag/Throw Component Disables Buttons?

Feb 20, 2005

I have buttons on my main timeline which calls a MC using attachmovie(). I have placed an EmptyMC on my main timleline for the MC to be inserted. Now, this particular MC has buttons on it which work fine. However, when I add a throw component onto the EmptyMC, which basicly lets me drag/throw my attached mc, the buttons are disabled. How can I go about correcting this?

Here is the code for the button on the main timeline:

on (release) {
_root.EmptyMC.attachMovie("Content Def", "Clip2", 1);
}

Here is the code from the component I have attached to the EmptyMC:

#initclip 0
function ThrowBehaviorClass(){
// get the target
var target = this._parent[this._targetInstanceName];
// set up the various properties

[code]....

View 5 Replies

ActionScript 2.0 :: Referring To A Variable

Apr 17, 2003

say i have this code: blah = "123 + i" so blah is a variable right? so how would i refer to this variable? i want to be able to do: _root.blah.onPress = function () but this won't work beause you need an instance name instead, so how would you do this? thx, i hope you understood what i was saying

View 9 Replies

ActionScript 3.0 :: Referring To Instance With Variable?

Jul 23, 2009

I'm trying to access an instance by using a variable but when I try to manipulate a property to the instance (by referring to it with a variable) it only recognizes it as a string... for instance... (pun intended??)
public var prevbutton:String = "btn1";
trace(["page"+prevbutton]);
// which traces - pagebtn1
trace(pagebtn1);
// which traces the instance class - [object btn1pageclass]
I want to call the instance by using a variable... how do I do this?

View 11 Replies

ActionScript 3.0 :: Referring To A Variable Within A Class?

Feb 5, 2009

I have found a tutorial which shows me how to create a class. It also shows me how to construct an object in the main code. What I want to do is to access a variable from the object that I made. Heres the code...This is the link to the tutorial:http:[url]....

Code:
package
{
public class Car [code]....

Then I use this code to construct the object, which in this case is a car (the code is in my main flash file):

Code:
var mycar:Car = new Car("Porche", 3.2, 4, "Normal doors");

I understand all of the code, but how do I reference a variable like the engine? I have tried lots of things like "trace(this[mycar] .engine)", "trace(mycar.engine) but nothing seems so work. I just get error messages of property undefined.

View 4 Replies

ActionScript 2.0 :: Referring To Variable LoadVar Dynamically?

Mar 31, 2004

I am reading a file with certain user defined variables like &x=30&y=50&z=100

Lets the variable is caught in a function as argument myVar

now depending on the variable the user passes I need to fetch the value. ie if the user passes x i need to read the value of x. how the user has named his/her variables.

What i need to do it get the value of that variable by using loadVar.

this.myVar; As such it gives me undefined. There is text present in 'this' myVar represents 'x' I have tried eval(this.myVar) as well as this.eval(myVar) but in vain

View 5 Replies

Actionscript :: Flex - Access Variable From One Component Into Another?

Jul 18, 2010

I have a main application which has an int variable declared. I want to access this variable in another component which is present in another package. How can I do this?Main.mxml (default package)

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"

[code].....

View 4 Replies

Flex :: Assign Variable To MXML Component ID

Jun 30, 2011

I have my custom component and for example few Label. I want to pass to my component value which will be assign to label's id.[code]Error: {test} is not a valid identifier.

View 1 Replies

Flex :: How To Access Variable In Parent Component From Child

Sep 18, 2010

I have a public variable set within fx:Script tags in a parent component that I'd like to access directly from a child component. How can I do this? I don't want to pass the variable to the child component (I know how to do this and am currently using this approach). Following is a simplified version of the mxml:

Note: SimpleComp is an HBox with a couple of lists.
<mx:Accordion>
<comp:SimpleComp/>
</mx:Accordion>

View 4 Replies

Flex :: Bind Variable To ItemRender Component Property?

May 16, 2011

I would like to bind a variable from my ActionScript to a property of a component that is in a ItemRender. But I always get this error:

1120: Access of undefined property currentRoom.

Here is my code

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:solutionItems="com.barco.components.ControlRoomConfigurator.solutionItems.*">
<mx:Script>

[Code]....

I would like to use the object currentRoom in my ItemRenderer component.

View 2 Replies

Flex :: Why Does The Flash Player Throw A Sandbox Error In This Case

Nov 10, 2009

I get a Flex 3 sandbox error #2048 after connecting to a Socket on a Java (1.5) server. The server code is all mine, i.e. not running under Apache. Flash Player 10.0 r32.The sequence is as follows...

1 Java server starts, listens on port 843 for policy file request and on port 45455 for my other requests.

2 Flex client served by Apache (although I get the same result if I run it from the file system), socket connection made on host:45455.

3 Flash Player requests policy file from port 843. This is the standard behaviour with the new security settings looking for a master file. It happens regardless of whether a different policy file has been specified.

4 I serve the following XML from Java through port 843:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*" secure="false"/>
</cross-domain-policy>

5 The player writes the following into the debug policy log...

OK: Root-level SWF loaded: http://localhost/bst/BasicSocketTest.swf
OK: Searching for <allow-access-from> in policy files to authorize data loading from resource at xmlsocket://192.168.2.3:45455 by requestor from http://localhost/bst/BasicSocketTest.swf
OK: Policy file accepted: xmlsocket://192.168.2.3:843
OK: Request for resource at xmlsocket://192.168.2.3:45455 by requestor from http://localhost/bst/BasicSocketTest.swf is permitted due to policy file at xmlsocket://192.168.2.3:843

6 I send a text message from the client to the server on port 45455 using writeUTFBytes() and flush() (this is my own home-baked message protocol, and is correctly processed at each end)

REG/REGISTER;simon;Si

7 Java server thread listening on port 45455 responds with

REG:0/REGISTER:SUCCESS;simon;Si

8 The Flex client receives a ProgressEvent and the event listener I bound to the socket gets called. I process the message (write it to a text box on the screen)

9 The Flash player throws a 2048 sandbox error and the socket is disconnected! This is after the message is received and processed successfully. In fact it is about 12 seconds after. Nothing else works through the socket.

I have tried explicitly loading a policy file with a call to Security.loadPolicyFile() in the Flex client, but the reality of the new player security is that it is basically ignored. The steps are that the policy request will not get sent until a socket i/o operation occurs. At that point the player always goes to port 843 first looking for a master policy file. If it finds one, and it is permissive, it goes no further.

I have tried a variety of alternative ways of terminating the policy file and policy file contents, including deliberate errors just to see if the Flash Player is awake.I can see no reason why I would have a 2048 being thrown. I accurately serve a socket policy file on the designated master security port, which the player itself logs as correct. The socket then successfully sends and receives a message from the server the contents of which are available to my code.

P.S. Please don't tell me to use BlazeDS or LCDS or Granite, or something else as a server, I'm looking for a solution to this problem, not a redesign. And please don't ask me to use an XMLSocket instead - I tried that and get exactly the same result. I have chosen my architecture carefully and deliberately and I want a binary socket.

EDIT :In response to James Ward's request in his comment, here is the entire error message:

Error #2048: Security sandbox violation: http://localhost/bst/BasicSocketTest.swf cannot load data from 192.168.2.3:45455.

I have a stripped down test client which has a handler for each socket event and outputs a message to the screen. This is what it shows:

RequestPolicy: 192.168.2.3:843
Create Socket: 192.168.2.3:45455
Connect: [Event type="connect" bubbles=false cancelable=false eventPhase=2]
Sending: REG/REGISTER;simon.palmer@gmail.com;Si
Receiving: REG:0/REGISTER:SUCCESS;simon.palmer@gmail.com;Si/
Close: [Event type="close" bubbles=false cancelable=false eventPhase=2]
Error #2048: Security sandbox violation: http://localhost/bst/BasicSocketTest.swf cannot load data from 192.168.2.3:45455.

The close event is fired immediately after successfully receiving a response from the server, however the Error #2048 does not appear until about 20 seconds later. If I try and send a further message after close, but before the error, the Flash Player throws an invalid socket exception.

View 9 Replies

Java :: When Does Flex Throw NetConnection.Call.Badversion Error?

Nov 11, 2010

I am Using Flex as my client and java as my server. Using Weborb in remote host. At times I recieve this error.

faultCode:Client.Error.MessageSend
faultString:'Send failed'
faultDetail:'Channel.Connect.Failed error NetConnection.Call.BadVersion: :

[code].....

View 2 Replies

Flex :: Getting A Variable From Your Regular Component To Inline Item Renderer

Jul 29, 2009

I am trying to turn labels red when they can no longer be added to a list because of size requirements. The renderer works but Flex creates a separate component. I can't think of any good way to get that value to the new component.[code]

View 1 Replies

ActionScript 3 :: Referring To External Source In Flex Compiler

Jan 27, 2012

Is there a external-source-path option available in Flex compiler similar to external-library-path? My requirement is that, I am building a "SWC" file but I don't want to include certain folders inside my 'src' folder as these are anyway available in my other application during run time. (Trying to be resource constraint). So, I want to use these folders during compilation but do not want to include them in the generated "SWC" file.

View 2 Replies

Actionscript 3 :: Pass A Variable From Custom Component A Different Component?

Dec 8, 2011

In my custom component (Login), I create and set a variable userName, it is bindable: [Bindable] private var userName:String; userName = txtUsername.text; I need to pass that variable to a different custom component (Overview), here is the code of the viewstack:

[Code]...

I've searched for a way, but I haven't found one that does the trick.

View 1 Replies

Flex :: 4 - Null-component - Checking If The Cancel Button Component In The Child Component?

Jun 23, 2011

I have a component "child" which has a cancel button. Now this component is placed in a state called "newChildComp" I also have another component called "parent". In the parent component, i have a button that dispatches an event. Here is the event code:

[Code].....

so, basically,i am checking to see if the cancel button component in the Child component, while i am still in the parent Compoent, was clicked, if it was clicked, call the cancelButtonHandler. The problem is by the time the addNewChild handles the event, that cancel button was still null. My question is how do i solve this without using the itemCreationPolicy on the cancel button?

View 1 Replies

Flex :: When Using BlazeDS's Proxy-config Throw FaultDetail="Connection Refused: Connect"?

Dec 10, 2010

I have created a XML file directly under the webroot, named index.jsp, the contents are as follow:

<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<?xml version="1.0" encoding="utf-8"?>
<catalog>

[code].....

View 1 Replies

Flex :: Make A Custom Component Or Extend The List Component For A 2D Top Down View MAP ?

Nov 11, 2010

I'm building a top view 2D map, that it's objects are stored on the server.The kind of objects are 10 and might be a photo, label, button, lists, mix of them or labels with tooltips.The component must request the "areas" that are missing on screen.An area is 1000x1000 px and is cached in flex.To move in the map, will be like in google maps (drag-and-drop).I should be able to have another list and move objects from one to another using drag-an-drop on objects. Ex.: I grab an objects from a list and I move it on this map, I release the mouse button and the item is placed there.Now the problem is: I build a custom component for this trying to emulate the item renderer for performance and recyclage, implement drag-and-drop on objects and request the areas that are missing?

or

I extend the List component from spark and I add some features as multiple kind of itemrenderers and use recycle on them. Of course it must be able to request the missing areas on the screen and cache it's data.Maybe create a custom layout is needed too.What I need is something that must be really fluid, so the lighter this component is, the better.

UPDATE: *There will be not any object over another.

*I will not use hitTest on bitmaps because all bitmaps are wrapped in another component,as they,for now are itemrenderers.

Anyway I already begin to do this using a class that extends the SkinnableDataContainer and a custom layout. As the layout is not like a grid, is sparse, random items at diferent points(x, y).How to get the localX and localY, relative to item renderer and not to the Spark List, from a DragEvent in Flex 4?

View 1 Replies

Actionscript 3 :: Flex - Access Component Inside Another Component In MXML?

Sep 3, 2009

I have two components. One is called "InsideComp" and one is called "OutsideComp". OutsideComp has InsideComp as one piece of its component, and in my main MXML file, I have embedded an instance of OutsideComp. How do I access a public variable of InsideComp within my main MXML file?In Actionscript, I could just do something like:OutsideComp.InsideComp.valToChange = 5; But I dont know how to do it in MXML. I know this is probably an easy question.

View 4 Replies

Flex :: Access The One Component Properties Form Other Component With Out Binding?

Sep 21, 2011

I would like to bind two components with out binding and which resides in different MXML.for eg: A.mxml has textinput and B.mxml has a combobox when choose one item in B.mxml selected item should be display in A.mxml textinput.

View 2 Replies

Flex :: Access Component Properties From Extending Component

Jul 29, 2011

I have a component with a public variable declared

[Bindable]
public var mnuSource:String;

When I extend this component, I can reference mnuSource (it compiles) but Runtime complains about the property not being accessible (error 1056).

How do you modify / declare component properties so they are actually available to other components?

View 2 Replies

Actionscript 3 :: Throw A Ball In An Arc?

May 27, 2011

I am trying to throw a ball in an arc, either an arc going left or right.

Here is my code:

var gravity = 2;
this.velocity.y += gravity;
_angle = 5;

[Code].....

It doesn't really look like the ball is "arcing" at all, it seems to be more of a diagonal line?

View 3 Replies

Flex :: Remove A Component Using A Button In The Component?

Sep 29, 2010

I'd like to use a button within a component to remove it. So, you click it and the component is gone. But, I haven't figured out how you reference the component from within the component. What should I put in click=""?

My component: popCanvas

<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Panel width="200" height="200" title="hello"
click="remove=">

[Code].....

View 1 Replies

Flex - Define A MXML Component And Update MXML Component In Flex Application

Aug 12, 2009

A Flex components values are initlized by init methord. In an application flow, How to refresh a mxml component data value ; as init is callled at the start up it self only.

eg. of mxml componet may be as simple as button label or text as complex as repeater whose data provider is a web service ( means a fresh quesy should be made to pull the data and refresh the dataprovider of repeater )

View 3 Replies

Access Array Elements Throw Different Swf's?

Jul 9, 2011

I need to access the elements of an array that is declared in the main swf(_level0). But I need to change it from another swf.How can I do it??So far I have this:

MAIN SWF:

var vector1:Array = [biblio_vid1, biblio_vid2, biblio_vid3, btn_1_4, biblio_vid4];

OTHER SWF:

var vector2:Array = _level0.vector1.slice();
trace(vector2); // undefined,undefined,undefined,undefined,undefined

View 2 Replies

Flash :: Drag And Throw With Easing?

May 28, 2010

I'm creating a map in flash and I would like to have a smooth movement similar to this:[URL]..i have made a start but I'm having trouble taking it to the next stage.

My code currently throws the movieclip after the mouse is release but there is no easing while the mouse button is down.

[Code]...

View 1 Replies

Actionscript 3 :: Throw A Button In Flash?

Feb 21, 2012

I'm trying to make a button draggable and also throw it across the screen. I know that I have to use the mouseDown and mouseUp options for the button, but could someone explain a method for allowing me to drag it and then throw it? In other words, it should keep going after mouseUp.

View 1 Replies

ActionScript 2.0 :: Throw And Slide Function

Oct 22, 2010

Anyone know a easy way to grab and throw / move a movieclip so it slides for a bit then gradually slows down?

View 1 Replies

ActionScript 2.0 :: Setting A Component Variable

Mar 23, 2009

How do I set/access the "Text File" variable as shown in the two pictures. _root and _global don't work.I also tried to access it from _root.CrosswordPuzzle.cp_words_textfile.I don't get components.

View 1 Replies







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