How to use FlashVars to initialize a Flex component?

Hi all,
I am trying to pass arguments dynamically from a JSP to an embedded Flex app using FlashVars. The values are being passed correctly, but when my Flex app is first initialized, the FlashVars have not been assigned yet. I need to use one of the FlashVars to set a property of one of my Flex components, but the FlashVars are null when the component is created. How can I do this? Do I have to wait until the Flex app has loaded before setting the attribute? How would I accomplish that? Thanks in advance for your help.

I was able to resolve this, so I thought I 'd share the answer in case someone else has a similar problem. Instead of declaring the component (which is also a DisplayObject) in MXML, I create it in the ActionScript method that gets called on the application's creationComplete method and set the property using the FlashVar at that point. Here's a quick example, using a custom class called MyDisplayObject and a FlashVar called myName:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initVars()">
<mx:Script>
          <![CDATA[
                    private function initVars():void {
                         myName = Application.application.parameters.myName;
                         myDisplayObject:MyDisplayObject = new MyDisplayObject();
                         myDisplayObject.name = myName;
                         addChild(myDisplayObject);
               ]]>
</mx:Script>

Similar Messages

  • How to use my as3 file in flex

    hi, I am new in flex and want to divert into flex. How to  use my as3 file into flex. Is there any sample tutor . so, that I could learn fast.

    Please clarify. Is this .as file a class you previously used as a complonentcomponent you now wish to use as the main application?
    If the .as file just has variables and functions you wish to access from your Flex app, use:
    include "subfolder1/subfolder2/etc/MyASFile.as";
    If you want to use classes from the file, do this:
    import subfolder1.subfolder2.etc.MyClassName;
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex / AIR Development, Training, and Support Services

  • How to use image and text in same component

    Hello
    Do you know how to use image and text in same component in java ?
    because i need this in my project ,which is chat application , to
    put the received text and any image if it is need within the text

    thanks levi_h
    JTextPane class extends JEditPane and allows you to embed
    images or other components within the text managed by the component

  • How to Use Early Delta Initialization

    Hi BW Experts,
    We are in BI 7.0 Version. Only for Reporting we are using BI 7.0. For modeling, still we are using BW 3.1C only.
    We want to use Early Delta Initialization. But this is in Disable Mode in our system
    I am getting the following Messages:
    <b>"Extractors supporting early delta initialization are not available before plug-in (-A) 2002.1"</b>
    <b>"You cannot execute an initialization simulation together with an early delta"</b>
    Please can anyone give me the suggestion.
    Regards
    Anjali

    Hi,
    you have the option of writing the data into the delta queue or into the delta tables for the application during the initialization request in the source system. This means that you are able to execute the initialization of the delta process (the init request), without having to stop the updating of data in the source system. You can only execute an early delta initialization if the DataSource extractor called in the source system with this data request supports this..Use the Early Delta Initialization indicator in the InfoPackage if you want to avoid a period when no updates can be made (no document processing and update) in the source system while the delta process is being initialized. In some applications (such as LO Cockpit), an update-free period is nevertheless needed to fill the setup tables. In such cases, the update-free time is merely reduced. If you want to carry out early delta initialization, the update in the source system can continue  and the data can be written to the delta queue while the initialization requests are being processed. Note: DataSources that support early delta initialization are available as of the release Plug-In 2002.1. The field ZDD_ABLE (characteristic value = X) for table RSOLTPSOURCE (in BW) or ROOSOURCE (in the source system) indicates whether a DataSource can support early delta initialization.Not always on our systems an important downtime is possible in the initialization process during the reconstruction and the delta init request (just thinking when you need to ask a billing stop period...a real nightmare in some company !)
    For this reason, as of PI 2002.1 and BW Release 3.0B, you can use the early delta initialization to perform the initialization for selected datasources (just checking in infopackage update mode tab if this function is available): in this way you can readmit document postings in the OLTP system as early as possible during the initialization procedure..In fact, if an early delta initialization infopackage was started in BW, data may be written immediately to the delta queue.
    But, if you are working with the queued delta method, using early delta initialization function doesn’t make sense: as described before, it’s the same method definition that permits to reduce downtime phase.
    But leaving aside that, don’t forget that, regardless of the update method selected, it’s ALWAYS necessary to stop any document postings (for the relevant application) during setup tables recompilation run

  • How to use UI elements in abstract portal component

    hi all
    i am new to portal development..i want to use different UI elements such as textbox,buttons using abstract portal component.can anyone telme how to use them.

    Yes Asusha
    You can use JSP , JSPDyn pages in Abstract portal component.
    You can call a Jsp file from the abstract portal component.
        public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
         com.sapportals.portal.prt.resource.IResource somePage =          
                   request.getResource("jsp", "pagelet/test.jsp");
                   response.include(request, somePage);
    Then you can made your desired UI in JSP.
    Hope this helps..
    Cheers
    Chinmaya
    Reward for helpful answers

  • How to use classes of packages in flex mx:Script/ or mxml/

    Hi.I am just learning Flex using Flex Builder 3 facing one problem,
    Suppose I declare one package with name alert.as
    package
    import mx.controls.Alert;
    public class alert
    public function alertBtn()
    Alert("Hello btn 1");
    Now in want to use the function in mxml that I declared in a package.
    <mx:Button label="btn1" click="alertBtn();"  />
    I have few questions
    1)How to Import the class alert.as in <mx:Script> and where should i store the file alert.as in the directory folder of flex?
    2)How to call the function alertBtn() when btn1 is clicked.
    Thanks so much!
    Regards
    Ankur

    Hi Greg.I think I was not able to clear my problem properly.Let me try this time again.
    What I wanted to do was that in the below written code I have the full access of the id=panel1 in the  script tag .This works properly.
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script><![CDATA[
    import flash.display.Sprite;
    import mx.core.UIComponent;
    private function addChildToPanel():void {
    var circle:Sprite = new Sprite();
    circle.graphics.beginFill(0xFFCC00);
    circle.graphics.drawCircle(0, 0, 20);
    var c:UIComponent = new UIComponent();
    c.addChild(circle);
    panel1.addChild(c);
    ]]></mx:Script>
    <mx:Panel id="panel1" height="100" width="100"/>
    <mx:Button id="myButton" label="Click Me" click="addChildToPanel();"/>
    </mx:Application>
    This above functionality when I tried to do using class Outside the code ,its not working !
    Here is with the package:-
    But suppose I make One package 
    package
    import flash.display.Sprite;
    import mx.core.UIComponent;
    class getPanel extends Sprite
    public function addChildToPanel():void {
    var circle:Sprite = new Sprite();
    circle.graphics.beginFill(0xFFCC00);
    circle.graphics.drawCircle(0, 0, 20);
    var c:UIComponent = new UIComponent();
    c.addChild(circle);
    panel1.addChild(c);
              }//class
                        }//package
    Now in MXML
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script><![CDATA[
    import getPanel;
    ]]></mx:Script>
    <mx:Panel id="panel1" height="100" width="100"/>
    <mx:Button id="myButton" label="Click Me" click="getPanel.addChildToPanel();"/>
    </mx:Application>
    So My problem is that this code doesnt do anything.
    Neither the addChild function is working in it ,Nor the Panel1 is accessible here.
    Can u pls help me here.
    Thanks
    Ankur

  • How to use Google weather API in flex?

    Hi there,
    I have 2 services.
    ServiceONE : http://api.locationservice.com/city/key=123abc
    ServiceTWO: http://www.google.co.in/ig/api?weather='anyCityName'
    I am using HTTPService for both. Firstly I fetch result which gives me city name, by sending ServiceONE. And then, I am assigning this city name to SericeTWO and sending it, which gives me weather details about that city.
    I am hosting my applicaition on some server, http://www.somethirdpartyserver.com/myaccount/myflexstuff/MyWeatherApplication.html
    Since it tries to access http://api.locationservice.com/city/key=123abc and http://www.google.co.in/ig/api?weather='anyCityName', I would need to have crossdomain.xml in them.
    Fortunately I could find http://api.locationservice.com/crossdomain.xml, which has:
    <?xml  version="1.0" ?>
    <!DOCTYPE  cross-domain-policy (View Source for full doctype...)>
    - <cross-domain-policy>
    <site-control permitted-cross-domain-policies="all" />
    <allow-access-from domain="*" secure="true" />
    <allow-http-request-headers-from domain="*" headers="*" secure="true" />
    </cross-domain-policy>
    Which mean, any server can access it.
    But unfortunately, I couldnot find something similar in http://www.google.co.in/crossdomain.xml. Though xml is there, the code is different:
    <?xml  version="1.0" ?>
    <!DOCTYPE  cross-domain-policy (View Source for full doctype...)>
    - <cross-domain-policy>
    <site-control permitted-cross-domain-policies="by-content-type" />
    </cross-domain-policy>
    It doesn't allow any access to any domain.....
    I've already developed the weather gadget in flex but I cant host it for use anywhere, because of this security issue
    Can anyone kindly help me how can this be resolved?>?
    -Deepak

    @ PaulH
    Yes, after few more searches I came across php proxy solution. I should have checked about availablity of crossdomain file in the root of the api, which I didn't and started off with the development.
    For now I'll use this php proxy and use Google weather api. And yes, as you said, it's not official. Can get changed\removed, which will surely affect my code.
    Thanks for http://www.worldweatheronline.com/, may be I'll try to implement it with this api soon and make my app completely stable!
    Came across another great api for weather which too has crossdomain! http://www.wunderground.com
    I've uploaded the widget right here: http://deepflex.blogspot.com/2011/03/weather-widget.html
    @alexsliced
    Adobe Flex is a software development kit (SDK) released by Adobe Systems for the development and deployment of cross-platform rich Internet applications based on the Adobe Flash platform. Flex applications can be written using Adobe Flash Builder or by using the freely available Flex compiler from Adobe.
    You can find more about it here:
    http://flex.org/what-is-flex
    http://en.wikipedia.org/wiki/Adobe_Flex

  • How to use FC to make a sub-component for Flex

    Most of the examples and tutorials I've seen so far assume you are creating the app itself in FC.
    However, what I need to do is create a custom component that will be a "screen" in a large Flex app, like a page in a Wizard.
    So if I was doing this without FC, I'd make a new mxml component in Flex, e.g. "WizardStep.mxml" and then in the main app,
    <mx:ViewStack>
         <h:WizardStep id="one" label="Step One" />
         <h:WizardStep id="two" label="Step Two" />
    </mx:ViewStack>
    For example, assuming I have set up the namespace "h" to like "com.handycam.*"
    How would I accomplish this scenario if "WizardStep" is what I have been building in FC?

    Thanks for your answer!
    Unfortunately it still doesn't work.
    In FC I used the file menu item "publish as swf" ( or however it's called in English -
    I'm also struggling with the -unwanted- German workspace terms). This generated
    the deploy-to-web and run-local folders. In Flex3, I imported haupt.swf (=main.swf)
    from the run-local folder.
    When I use the imported file in the Image tag with the
    loadForCompatibily attribute set to "true",the application compiles,
    opens the IE, the remaining LinkBar buttons are not affected - they
    show/run the Flash Pro .swfs and their controls,
    but the attempt to access the .swf in question produces:
    VerifyError: Error #1053: Illegal override of z in mx.core.UIComponent.
    at flash.display::MovieClip/nextFrame()
    at mx.managers::SystemManager/deferredNextFrame()[C:\autobuild\3.2.0\frameworks\projects\fra mework\src\mx\managers\SystemManager.as:319]
    at mx.managers::SystemManager/preloader_initProgressHandler()[C:\autobuild\3.2.0\frameworks\ projects\framework\src\mx\managers\SystemManager.as:2945]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.preloaders::Preloader/timerHandler()[C:\autobuild\3.2.0\frameworks\projects\framework\ src\mx\preloaders\Preloader.as:398]
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()
    The alternative approach:
    <mx:SWFLoader x="3" y="35" width="970" height="425" loadForCompatibility="true" source="insets/haupt.swf"/>
    produces:
    VerifyError: Error #1014: Class flash.text.engine::TextLine could not be found.
    at global$init()
    If I code the SWFLoader tag as:
    <mx:SWFLoader x="3" y="35" width="970" height="425" loadForCompatibility="true" source="
    @Embed(source='insets/Haupt.swf')"/>
    I get the same errors as I did for the Image tag approach.
    Hope this helps.

  • How to use zimbra email system in flex

    hai i ma new to flex i would like to know .wheather we can
    use the zimbra email system in flex.if yes then how it is? please
    send details ASAP

    "gsrinu27" <[email protected]> wrote in
    message
    news:gh2dgn$9tf$[email protected]..
    > hai i ma new to flex i would like to know .wheather we
    can use the zimbra
    > email system in flex.if yes then how it is? please send
    details ASAP
    The socket connection tutorial here may point you in the
    right direction:
    http://www.gotoandlearn.com/

  • How to use custom HTML page in flex web application with out using iframe

    Hi all,
              I have to import a custom HTML page (that has got links to another html pages) inside my flex web application and i dont want to use IFrame. Can you please suggest me with best example.
    Please help me out as i'm new to flex.
    Thanks,
    Swetha.

    Hi, there:
    Best thing to do is to start with the default login.html page, and then modify it. The login screen is fairly complex and it's easy to just miss a JS function you need to call. To get to default page, you would need to do one deploy (to simulator or whatever), and then look for login.html page in the temporary Xcode or Android project generated from the deployment. It should be under the "deploy" directory in your JDev workspace.
    You can also see all the framework JS files and CSS files that way as well.
    We have had customers implementing custom login screen so we know it can work, but they all had to start with the default login screen and then modify it.
    Thanks,
    Joe Huang

  • How to use FlashVars to set the default option on a combobox

    We are using XCelcius to display data in an XML file that is populated by another program using the Web Services approach.
    On our widget, there is a combobox that allows the user to select a specific range of data.  In Xcelcius, the value of this combobox can be defaulted using the Behavior->Default Options->Combo.
    This is good, but this also means hardcoding a particular value.  What we'd like to do is set the Default Option on the combobox via a FlashVar.
    Is this level of behavior exposed via the FlashVars so we can define the default option in our HTML file?
    Thanks for reading.

    unfortunately you cannot dynamically set the default option in 'Any' selector - so your Flash Vars approach will not work

  • How to use LIVE images within a flex app

    My App is composed of links to other websites. Currently these links are in the form of images which are basically static screenshots of the websites.
    What I want is for these images to instead be live i.e. what the website looks like currently. So if the website changes it's background colour etc this will change within the image making it a live screenshot. This is something my client wants so that the app is is basically self updatable. Can anyone help me out on how to do this please?

    I see what you mean about the clickable transparent overlays as this would stop the user interacting with the images which is what I want and I also see what you mean about it being hard to scale the images as it seems iframe has it's own scrollbars and includes the entire screen rather than thumbnails.
    My further problem is that I need to display these images in a tilelist that the user can scoll up and down and the images need to be drag and droppable between 2 tilelists. Yikes. They already are drag and droppable at the moment and are all displayed within a tilelist but I just need to make them live.
    Now I'm scared. Ha.

  • How to use Custom URL scheme in flex?

    I wanna integrate whatsapp in my flex mobile app. Here is the solution.
    http://www.whatsapp.com/faq/en/iphone/23559013
    Can any one please help me in implementing this.
    Thanks in advance.

    in what respect?

  • How to use vertical scroll browser in Flex web app?

    Hi,
    I´m developing a web app with flex3. Web app has linkbar connected to a viewstack,
    that contain inside a canvas that change the height property depending on the option
    selected on the linkbar. My problem is that, when the viewstack resizes his canvas
    and has the height property bigger than the resolution of the web browser, shows a
    vertical and horizontal scroll inside de canvas. I need not to show the scrollbars
    inside the canvas, I need to show the vertical scroll bar in the general container, I
    think in application. I try to set the property verticalScrollPolicy to "off" in the containers
    and "auto" or "on" in application. The containers don´t show now the scrolls bar and
    application shows an empty vertical scroll bar. I would need to have an vertical scroll
    bar working properly in application. Somebody could help me, please.
    Thanks,

    I could make it work by dragging them to the src folder.
    That's exactly what you need to do. After all, they're source files
    When you define "src" as the source directory, that's where the compiler will look for classes/packages.
    So the package net.xyz.widgets.* resolves to src/net/xyz/widgets/

  • Trying to figure out how to use my xml with a tree component

    Hi All,
    I am trying to use a tree control for the first time and
    having a bit of difficulty. I have a Domino server that will
    generate XML for a specific view of information. The view looks
    just like what a tree control would look like. I wish I could paste
    a screen print . . .
    It looks like this:
    +/- ...01/31/2007
    ..+/- Steven Rieger
    ..........Company
    Name...Project-Number...Task-Name.....Total-Hours...Sat...Sun...Mon...Tue...Wed...Thu...F ri
    The Date and Name are collapsible .
    When I get the generated xml it's got a lot of crazy
    information in there that I don't need. I'm hoping someone can look
    at the xml below and provide some insight into how to parse it to
    achieve the look above.
    Thanks for your help!!!!
    - <viewentry position="1.1" noteid="80000008" children="2"
    descendants="6" siblings="30">
    - <entrydata columnnumber="1" name="$16"
    category="true">
    <datetime>20071026</datetime>
    </entrydata>
    - <entrydata columnnumber="7" name="TSTotHours">
    <number>53.5</number>
    </entrydata>
    - <entrydata columnnumber="8" name="TSHours_1">
    <number>6</number>
    </entrydata>
    - <entrydata columnnumber="9" name="TSHours_2">
    <number>9</number>
    </entrydata>
    - <entrydata columnnumber="10" name="TSHours_3">
    <number>6.5</number>
    </entrydata>
    - <entrydata columnnumber="11" name="TSHours_4">
    <number>8</number>
    </entrydata>
    - <entrydata columnnumber="12" name="TSHours_5">
    <number>8</number>
    </entrydata>
    - <entrydata columnnumber="13" name="TSHours_6">
    <number>8</number>
    </entrydata>
    - <entrydata columnnumber="14" name="TSHours_7">
    <number>8</number>
    </entrydata>
    </viewentry>
    - <viewentry position="1.1.1" noteid="8000000C"
    children="2" descendants="2" siblings="2">
    - <entrydata columnnumber="2" name="$15"
    category="true">
    <text>Steven Rieger</text>
    </entrydata>
    - <entrydata columnnumber="7" name="TSTotHours">
    <number>40</number>
    </entrydata>
    - <entrydata columnnumber="8" name="TSHours_1">
    <number>0</number>
    </entrydata>
    - <entrydata columnnumber="9" name="TSHours_2">
    <number>4</number>
    </entrydata>
    - <entrydata columnnumber="10" name="TSHours_3">
    <number>4</number>
    </entrydata>
    - <entrydata columnnumber="11" name="TSHours_4">
    <number>8</number>
    </entrydata>
    - <entrydata columnnumber="12" name="TSHours_5">
    <number>8</number>
    </entrydata>
    - <entrydata columnnumber="13" name="TSHours_6">
    <number>8</number>
    </entrydata>
    - <entrydata columnnumber="14" name="TSHours_7">
    <number>8</number>
    </entrydata>
    </viewentry>
    - <viewentry position="1.1.1.1"
    unid="8625721300797D8686257383001826AE" noteid="B4E"
    siblings="2">
    - <entrydata columnnumber="3" name="$178">
    <number>0</number>
    </entrydata>
    - <entrydata columnnumber="4" name="TSPCompany">
    <text>101955 - Acme Company, Inc.</text>
    </entrydata>
    - <entrydata columnnumber="5" name="TSPProject">
    <text>P03036 - CAC 07/08</text>
    </entrydata>
    - <entrydata columnnumber="6" name="TSPTask">
    <text>10134 - Import from Access to Notes</text>
    </entrydata>
    - <entrydata columnnumber="7" name="TSTotHours">
    <number>24</number>
    </entrydata>
    - <entrydata columnnumber="8" name="TSHours_1">
    <text />
    </entrydata>
    - <entrydata columnnumber="9" name="TSHours_2">
    <text />
    </entrydata>
    - <entrydata columnnumber="10" name="TSHours_3">
    <text />
    </entrydata>
    - <entrydata columnnumber="11" name="TSHours_4">
    <text />
    </entrydata>
    - <entrydata columnnumber="12" name="TSHours_5">
    <number>8</number>
    </entrydata>
    - <entrydata columnnumber="13" name="TSHours_6">
    <number>8</number>
    </entrydata>
    - <entrydata columnnumber="14" name="TSHours_7">
    <number>8</number>
    </entrydata>
    </viewentry>

    If the depth of the structure is constant, you can do it in a
    single function call. If you need to go down an unknown number of
    nesting levels, your function will need to be recursive.
    XML.children() gives you an XMLList of the child nodes. You
    can for-loop over this XMLList. Inside the for loop, add thexml you
    want to the new XML object.
    Tracy

Maybe you are looking for

  • IE10, Reader XI, Win 7 x64 - can't read pdf files in browser

    Hi, As the title says, am using Reader XI, IE 10, Win7 x64. Every time I click a hyperlinked pdf, I get a new tab and a black x in the top left corner. Astonishingly this behaviour persists if I disable the pdf reader add-ons (i.e. pdf's are not laun

  • Need a Query for getting ItemCost from PO Vendor wise

    Hi,Experts We are not maintain different price list for  some particular items , We raised the PO for Multiple vendors with differnt price for the same material. We need a query to find the Item cost with Various Vendor . I need the query in the foll

  • PCR, ISR_SPECIAL_DATA_GET -Salary Information

    Hi All, I need few pointers for problem described below. We have a custom PCR( ISR ) for Transfer outside Team which should go to next level manager if the receiving manager has proposed a salary change, if there is no salary change it should go to H

  • Dvd-disc stuck. How do I get it out?

    Hi, I put in an dvd that the dvd player can´t read. But now I don´t even get it out. The "eject dick" command is not feasible in the toolbar and ommand-E dosn´t work either. Is there another way? gunnar

  • Control kids time on apple extreme base

    I need help trying to prevent my teenagers from become useless victims of the internet. Can any one tell me of a way to set the amount of time the WI-FI network is used rather then the specific time? It seems like the only control available through t