Flex :: Setting Variables During Component Initialization

Oct 25, 2010

I am loading a component which makes a HTTPService call to get data that will then be used to set certain variables in the component. I make the HTTPService call in an init() function (for the initialization event) and then set the variables according to the data received in the HTTPService result handler. However, the variables are still null at both the initialize stage and at the creationComplete stage. If I try and read the variables in a creationComp() function (for the creationComplete event), those variables are still null. Is this correct?

I guess I don't understand the flex initialization cycle very well. When are those variables actually set and available to be used? I need to manipulate those variables automatically after the component loads. Is there an event that comes after creationComplete that is appropriate or some other way to approach this? I am using Flex 3.

View 2 Replies


Similar Posts:


Flex :: Initialization - Completely Initialize A Component But Not Add It To The Display?

Dec 20, 2011

I need to completely initialize a custom component in my Flex app (i.e. I should be able to access it from action script and get its properties and its children etc), But I do not want to add it to the display or make it visible. I have tried to add it to my visible component, but keep it visible, but often many of its properties are set only when it is drawn, so i don't get what i need. Is there a way to add a custom component to some sort of 'Virtual' display, that is not visible to the user?

View 3 Replies

Flex :: Initialization Order Of Static Variables In Flex Causing Bug?

May 10, 2011

I've got a component written for my app by a third party developer and am trying to integrate it, but I've found a bug that seems like it's either a compiler bug, or there's something with how Flex and static variables work that I wasn't aware of.Basically, I have this:

public class ModeChangeController {
public static const DISPLAY_MODE:String = "DisplayMode";
}[code]...

If I use //V2 (i.e. comment out V1), a bug occurs at the startup of the application (some TextFields are uneditable and contains no text), but with //V1 and not V2, it works fine. If I comment out both, that also works fine (I don't get the TextField bug).It took me a while to figure out that it was that static const String that was causing the issue, but I'm still not sure why or if there's something I can do about it except for just moving the DISPLAY_MODE to Events (which is what I've done at the moment, but it's not a particularly nice solution).There are no errors in the log. The order of the includes in my BorderContainer code doesn't matter. I've googled for "as3/flex static initialization order" but haven't found anything.

Clarification: showInitialView() never gets called. It doesn't get there before the other bug shows up. Just having the V2 line there causes the problem.

Update: I've fixed my problem with the TextInput strings not showing: Turns out that adding the component caused the Tahoma font to not show up. However, setting the font-weight to bold fixed that problem, or switching to Arial. With that said, the original question still stands, because when I ran it without V2, it found Tahoma with normal font-weight.

View 1 Replies

Variables :: Initialization - "proper" Place To Initialize Class Variables?

Jun 23, 2010

Is it "better" to initialize AS3 class variables in the class constructor? Or can I just initialize them to their default value when I declare them at the top of my class? I ask because when there's a lot of class variables, it appears inefficient to declare them in one place and then initialize them in another when I could easily do both in the same place. It one option is better than the other,

[Code]...

View 2 Replies

Flex :: Setting Background-color For Flex Tree Component?

Oct 21, 2010

I have a Flex Tree component in my app. I set the icons for open and close.
BUT I can't find something about changing the default background-color from white to something different.

obviously there is no background-color setable in css...

View 1 Replies

Flex :: Setting Content Area In Custom Component?

Dec 11, 2009

I am trying to define the content area of a custom component that extends mx:VBox. The component has predefined headers and footers (visual children) and I want to set the area in the middle for adding children to the component. The component will be used like this:

<custom_component>
<mx:button/>
</custom_component>

How would I set this content area?

View 3 Replies

Actionscript 3 :: Flex: Setting A Style That Is Not Supported By A Component

Sep 2, 2010

I am wondering if flex enforce style settings and throws compilation errors if a style that is applid to a component that is not supported by it. Has any one tried it before ?

View 1 Replies

Flex :: Setting Up Content Children For Custom Mxml Component

Dec 9, 2009

I am trying to develop a custom component to act as a divider.

[Code]....

I would like to use this component to assign objects like this:

[Code]...

Unfortunately, this does not work. I get a compiler error saying: In initializer for 'left': multiple initializer values for target type mx.containers.Canvas.

View 1 Replies

Actionscript 3 :: Setting A Default Skin For A Custom Component In Flex 4?

Aug 18, 2010

How do you set the default value of skinClass for a custom component in Flex? I've extended the DropDownList with my custom component, but I would like to specify a default skin to go with it instead of always setting the skinClass value for each instance.

View 1 Replies

Flex :: Setting Font Size Of Header Of TitleWindow Component?

Mar 7, 2011

How can I set font size of title property (header) in TitleWindow component? If I use fontSize property, it sets the font size for all components in TitleWindow, which is not what I want. I only want to set it for the title. I'm using Flex 3.

View 1 Replies

Flex :: Setting Skin Class On A Host Component But It Is Giving Null Point Exception?

Apr 19, 2011

ADOBE SYSTEMS INCORPORATED Copyright 2008 Adobe Systems Incorporated All Rights Reserved. NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms of the license agreement accompanying it.

[Code]...

View 1 Replies

Flex :: Adobe - Flex Browser Application Initialization?

Sep 3, 2011

to point out some good tutorials on creating applications in flex that are don't have UI's?Actually, it looks like all I really need to know is how to call afunction upon initialization of the flash object. I tried the creationComplete attribute, but it doesn't work in browser.

View 2 Replies

Flex :: Foregoing Initialization On A Page?

Jan 26, 2010

Once you load an actionscript page from scratch (in my case loading XML data from a file, initializing various other elements in a fairly time consuming way) if you navigate away from that page and then return to it, (via the browser 'back' key for example) is their a way to forego the previous initialization and just immediately bring up the previous Actionscript page in its fully initialized state.

View 2 Replies

Flex :: Bind To Global Variables Inside Component?

Aug 19, 2009

I've developed a component which is a combination of a few items (canvas, labels, etc...) but when I try to bind it to a variable such as: {stationXML.getItemAt(1).AAA.@value}, it doesnt work. Before I combined all the items in a component, they were all in the main MXML file at which time they worked. Not sure if it matters, but the "stationXML" arraycollection variable is declared inside the file "Station.as".

View 2 Replies

Flex :: Get Component Variables Values Into Main Application?

Mar 27, 2012

i have a component which gets the data selected by the radio button

<mx:itemRenderer >
<fx:Component id="radio">
<mx:RadioButton selected="false" useHandCursor="true" change="item_changeHandler(event)">

[code]......

View 1 Replies

Flex :: Unable To Generate Initialization Code Within Repeater?

Feb 22, 2011

Following error is arising if I use NavigatorContent in Repeater. Is there a way to initialize image and lable on which I am encountering following error: Unable to generate initialization codewithin Repeater, due to id or databinding on a component that is not a visual child.

Code:
<mx:Repeater id="rep" dataProvider="{usersArray}">
<s:NavigatorContent width="100%" height="100%" label="{rep.currentItem.name}" >

[code]....

View 1 Replies

Flex Application (SWF) Initialization Takes 25 Second To Load 1.6mb SWF In Widescreen Monitor

Mar 3, 2011

My Flex application (SWF) initialization takes 25 second to load 1.6mb SWF in widescreen monitor. The same SWF loads pretty fast (3 Sec) in Flat panel monitor 1024x768 resolution. What is the reason for +/- in rendering speed , +/- in CPU utilization on different monitors , screen resolution.

note: my internet sepped is 10+ mbps broadband.

View 1 Replies

Actionscript :: Flex MultiCore PureMVC Notifier Initialization Error

May 27, 2011

I am trying to write a simple multicore PureMVC helloword. I am getting Error: multitonKey for this Notifier not yet initialized!

[Code]....

View 1 Replies

Flex :: Slow Spark List Initialization With Custom Renderer?

Jun 7, 2011

I have a Spark list with a customItemRenderer that is taking a good 3 seconds to initialize with just 50 items.

I'm using Flex 4.5, my ItemRenderer is already very optimized, using as little nesting as possible, fxg and so on.

Is anyone having similar issues? I've tried almost everything in the book bar going back to mx.

View 3 Replies

Actionscript 3 :: Object Initialization Occur When Deserializing Binary Objects In Flex?

Sep 3, 2009

The jist of what I'd like to know and focus on understanding, is details on how binary deserialization occurs in Flex 3. When is the constructor called, when are properties set, are private members serialized or does all deserialization occur on and through setters, etc? I'm having a hard time finding information on this.In a Flex 3 AIR application, I have a pretty complex object graph(just a bunch of objects referencing one another, kinda like a big data model except a bit more complex) that I serialize to a file using a single call on the FileStream.writeObject and readObject on a root object, which serializes and deserializes the entire object graph.I found that I needed to always have a default constructor, else I would get exceptions on the objects when deserializing if they were part of an ArrayCollection. So I had to eleminate the constructor parameters or set default values. I now have many setters like this in my classes, such as the below where mConnection accumulates some information it needs through different setters, where as before I had this all packed into the constructor since all of the information is really necesary for the Connection to function:[code]So the connection's serverIP is still an empty string because the server was assigned to the client's property before the server was completely initialized.

I could probably resolve this by using binding so that updates to the serverip in the server are bound to the connection, but I find binding properties to be fairly complicated (it's really simple on UI in mxml cause you just use the curly bracket syntax but doing it by code is what I found complicated). I have also resolved some cases by removing the constructor parameters entirely, so that there is no default values. All that aside, I still really need a deeper understanding of the details of binary serialization as far as how it rebuilds the object graph. I even have circular references, and it seems to handle those fine and maintain multiple references without duplicating objects. It's just when my constructors/setters are more complex that I'm running into these problems because of the order of what occurs during deserialization. It is really inconsistent though, as adding breakpoints in various places seems to influence the order that things occur, making it more difficult to debug.On a side note for anyone that might sidetrack the topic because I am serializing a class called Connection. I added some code to address some things, like in the Connection class there is an instance of a Socket. Of course my socket would not be connected after I close and reopen the application and deserialize it, so before I serialize my object graph, I go through and close the socket and set the reference in the Connection class to null, so that there is no longer a reference to the socket and thus it will not get serialized. After deserialization on the next application run I create a new socket.

View 1 Replies

Java :: MessageBrokerServlet Initialization Problems- Push Data To Flex Application

Jan 25, 2012

I am working on a server push from Java to Flex. But some how the MessageBrokerServlet is not getting initialized, seems like it is calling a method from: flex.messaging.config.LoginCommandSettings.setMatch() Eventually I found out that this method indeed does not exist in that class (LoginCommandSettings). I there something else that is going wrong?

[Code]....

View 1 Replies

Flex :: MXML Composite Container Initialization Error "null"

Apr 16, 2010

I'm getting an odd error from my composite canvas component: An ActionScript error has occurred:

[Code]...

It seems to be related to the fact that my composite component has a child and I'm trying to add one in the place I'm using the component. So how can I do this correctly? omponent code looks like this (EditableCanvas.mxml):

[Code]...

View 2 Replies

ActionScript 2.0 :: (MX 04 Pro) Setting Variables For An Mc?

Dec 12, 2004

What i need is to set some values for a few movie clips and then use them all at once. Eg, i'll have 5 mcs in my movie, each with either variable = 1 or variable = 2 etc assigned to each of them differently. Then i want to run some code kinda like

if (the variable on mc_one < 4){
do some stuff
}

Im not sure if im going about it the right way, but i think its fairly obvious what im trying to do

View 5 Replies

ActionScript 2.0 :: (MX 04 Pro) Setting Variables For A Mc?

Dec 12, 2004

What i need is to set some values for a few movie clips and then use them all at once. Eg, i'll have 5 mcs in my movie, each with either variable = 1 or variable = 2 etc assigned to each of them differently. Then i want to run some code kinda like

if (the variable on mc_one < 4){
do some stuff
}

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

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

AS2 :: Setting PlayheadTime Of MediaPlayback Component

Nov 8, 2010

I'm building a custom Audio Player. The whole thing drives a MediaPlayback component. I have a scrubber set up that moves with the progress of the song. I want to be able to click and scrub with it though. Currently I have it set to set the playheadTime equal to the percent distance the slider is dragged to times the totalTime of the playback component. After the release of the slider I trace out the playheadTime and it seems to be fine, but I can't get it to resume playing at all. Here's the code in the controller:

var totalDistance = bar_mc._width - slider_mc._width;
var wasPlaying = false;
this.onEnterFrame = function(){

[Code]....

View 1 Replies

ActionScript 3.0 :: Setting Parameters Of A Component?

Mar 12, 2009

I'm trying to dynamically set some parameters of a component using AS3. The component has a parameter named "imagePath". I want to set this to a variable named "pathVar" This is where i'm at.

Code:
var pathVar
pathVar="images/folder1"
imagePath=pathVar

This clearly isn't working.

View 1 Replies

ActionScript 2.0 :: [F8] Setting Variables From External Txt?

Feb 20, 2009

I am trying to control some of the global variables in my script through an external text file.I have a variable called "_global.scrollOrNot", which determines whether I want flash to use the text window with a scroll-bar or the one without a scroll-bar. I am trying to control that through an external text-file called "ScrollCommand.txt". Here is my code:

the external txt states:

&sb1WindowScroll=yes
frame1:
_global.scrollOrNot;

[code]....

this is were I have a problem. It will always choose "MCtextFeldSB1noscroll". I have tested the whole thing with other variables, which were not changed by any LoadVars function and it works just fine then. As soon as I change the variable using the LoadVars function it will not work any more.

View 2 Replies

ActionScript 3.0 :: Setting Variables In A FOR Loop?

Apr 23, 2009

I used to dynamically set some variables using a FOR loop kinda like so PHP Code:

//Sorry, from memory
var possibleValues:Array = ["red","green","blue","yellow"];
for (i=0;i<possibleValues._length;i++){
_root["colorNumber"+i] = possibleValues[i];
}

Second question, using that code in a function would set the variables at the root level making them available throughout the timeline. Without "_root" how do I get that variable available to everything?

View 7 Replies







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