Variable Scoping in Flex/Flash

Both the Flex 2 and 3 compilers have warned me about duplicate variable definitions when the variables are in completely different scopes. This behavior is different than any other language I have used. To verify this behavior I used the following code:
if (1 == 0)
var test:int = 88;
logger.info(”test ” + test.toString());
else
test = 99;
logger.info(”test2 ” + test.toString());
The code compiles, runs, initializes the test variable and sets it to 99. The log entry in the (1==0) block, as expected, is not written. To rule out some sort of implicit variable declaration I commented out the line [var test:int = 88;] and the compiler promptly issued an undefined variable error. Any additional perspective on why test gets initialized in this code, or why this would possibly be considered correct behavior would be appreciated.

I just pulled the code into a window and added some code to eliminate errors (added hbx and vbx and tableData and a few dummy functions) and I am getting a clean compile with no warnings.  If you post all the code for the window that would help.  Here is the code I used.
<?xml version="1.0" encoding="utf-8"?><mx:Application 
xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="init()" xmlns:local="*">
<mx:Script>
<![CDATA[
import mx.controls.Spacer; 
import mx.controls.Text; 
import mx.containers.HBox; 
public var tableData:XML = new XML()  
public function init():void { 
this.vbxTable.setStyle("skinBgColor", "#505068"); 
var itemElement:XML; //DECLARE VARIABLE ONCE 
if (this.tableData.hasOwnProperty("title")) { 
if (this.tableData.title.length() > 1) { 
var left:Text = newTitle(this.tableData.title[0], "left"); 
this.hbxHeader.addChild(left); 
var space:Spacer = new Spacer();space.percentWidth = 100;
var right:Text = newTitle(this.tableData.title[1], "right") 
this.hbxHeader.addChild(right);}
else { 
this.hbxHeader.addChild(newTitle(this.tableData.title[0], "left")); 
if (this.tableData.hasOwnProperty("header")) { 
var headerX:XML = this.tableData.header[0]; 
var header:HBox = newHeader(); 
if (headerX.hasOwnProperty("item")) { 
for each (itemElement in headerX.item) { 
var hItem:Text = newHeaderItem(itemElement); 
if (itemElement.hasOwnProperty("@percentWidth")) hItem.percentWidth = itemElement.@percentWidth;header.addChild(hItem);
this.vbxTable.addChild(header);}
if (this.tableData.hasOwnProperty("row")) { 
for each (var rowElement:XML in this.tableData.row) { 
if (rowElement.hasOwnProperty("item")) { 
var row:HBox = newRow(); 
for each (itemElement in rowElement.item) { 
var rItem:Text = newRowItem(itemElement); 
if (itemElement.hasOwnProperty("@percentWidth"))rItem.percentWidth = itemElement.@percentWidth;
row.addChild(rItem);
this.vbxTable.addChild(row); 
public function newHeader() : HBox { 
var rItem:Text; 
return new HBox();}
public  
function newRow() : HBox { 
return new HBox();}
public function newTitle(r:String, t:String) : Text { 
return new Text();}
public  
function newRowItem(r:String) : Text { 
return new Text();}
public function newHeaderItem(r:String) : Text { 
return new Text();}
]]>
</mx:Script>
<mx:VBox height="100%" id="vbxTable">
</mx:VBox>
<mx:HBox height="100%" id="hbxHeader">
</mx:HBox>

Similar Messages

  • Data connection between Java Webdynpro - Flex Flash Island

    Hi,
    I'm developing a Java Webdynpro with connection to a Flex Flash Island. I'm using Flex 3.2.
    I've already set up the connection from WDJ to Flex, by using Events and the FlashIsland.fireEvent method, this all works fine. Now I'm trying to update a value in WDJ, to be updated in Flex. This gives the following error:
    Error: Error #1023: Stack overflow occurred.
         at Function/http://adobe.com/AS3/2006/builtin::apply()
         at mx.binding::Watcher/wrapUpdate()
         at mx.binding::PropertyWatcher/eventHandler()
         at flash.events::EventDispatcher/dispatchEventFunction()
         at flash.events::EventDispatcher/dispatchEvent()
         at mx.core::UIComponent/dispatchEvent()
         at UWLApplication/set opentask_updated()
         at MethodInfo-4234()
         at Function/http://adobe.com/AS3/2006/builtin::call()
         at sap.core.wd.context::WDContextListener/execute()
         at sap.core.wd.context::WDContext/notifyListeners()
         at sap.core.wd.context::WDContext/_set()
         at sap.core.wd.context::WDContext/set()
         at sap.wd.island::WDIsland/storeProperty()
         at sap.wd.island::WDIsland/onUpdateProperty()
         at mx.binding.utils::ChangeWatcher/wrapHandler()
         at flash.events::EventDispatcher/dispatchEventFunction()
         at flash.events::EventDispatcher/dispatchEvent()
         at mx.core::UIComponent/dispatchEvent()
         at UWLApplication/set opentask_updated()
         at MethodInfo-4234()
    This is especially strange, cause before I had a refresh button in which I updated my entire item collection. Now, I have added this field and suddenly I get this error !
    Does anybody has any idea what this could mean? Any help would be much appreciated ...
    My field in Flex:
    \[Bindable\]
    public var opentask_updated:Number;
    <mx:Text id="opentask_updated_text" text="{opentask_updated.toString()}" />
    My adaptions in WDJ:
    public void getInbox( )  {
           wdContext.currentInboxElement().setOpentask_updated(0);
    public void wdDoInit()  {
           getInbox();

    Solved!
    It appeared to be a "long" parameter and I was trying to put it in a "Number" parameter in Flex (because there is no long in Flex)
    When I changed both to String, it worked!

  • Using variable in function for FLASH video

    I have a webpage that uses PHP to pull a variable from a
    MySQL database.
    I would like to use that variable to tell my flash component
    what flash video to play. I cant seem to figure out how to place
    the variable in the function call to make it work.
    Also...The main page is in the root directory of my site with
    all my flash videos in a subfolder. I can't seem to get the videos
    to play on my main page unless they are in the same directory. I
    even tried to simply 'include' the movie into my existing page and
    it doesn't work.
    Any idea on either of these issues?
    (Is this even the correct forum area for this? I am new to
    using FLASH for this stuff)

    Thanks for the advice!
    Turns out I believe my answer lies in PHP, but I will check
    out the LoadVars help in FLASH too!
    Andrew

  • Flash Islands Tutorial I - Confusion with Flex/Flash Builder Versions

    Hi Guys,
    i am new to the Adobe Flex/Flash Islands technology and tried to implement Tutorial I by Thomas Jung. Unfortunately i am confused by the various different versions for flex and the corresponding IDE's.
    As far as i understood SAP at the moment only supports Flex versions up to version 3.3 for NetWeaver 7 EHP1. Furtheron the Adobe Charting Components (used in the Tutorial) seem to be part of the Flex Builder Professional Version only.
    So i went to the Adobe Website and looked into the products and download areas. All i found was Flash Builder 4.5 Premium and the various Adobe and Open Source Flex SDK versions. I am using Flash Builder 4.5 as a trial right now. Unfortunately the Charting Components are not included.
    So the question i have is whether the Charting Components (e.g. <mx:BarChart /> )are included in the non Trial version of Flash Builder 4.5 Premium or whether there is any possibility to get them as an Add-On. Or do i have to use Flex Builder 3 Professional (i found no information about this on the Adobe Website)?
    Additional Hint:
    I found out that when i compile the poject with Flex SDK vesion 3.6 or higher, the compiler knows the <mx:BarChart /> tag. Also in that case the view designer is working. However FlashIslands is only supported up to Flex SDK 3.3. But when i choose 3.3 the <mx:BarChart /> tag and some other related tags are unknown.
    This is a really anoying issue.
    Best Regards,
    Dirk
    Edited by: Dirk Jäckel on Jul 19, 2011 12:14 PM

    HI Dirk,
    wtith Web Dynpro, you can only use Flex SDK version 3.3 and downwards. You can download the SDK here [http://opensource.adobe.com/wiki/display/flexsdk/DownloadFlex3]
    Flash Builder ships with Flex SDK 4.5 which is not compatible with WDA flash islands.
    As for the charts library, which Adobe referes to as the Data Visualization Component, it is also available as a separate download which can be unzipped into the same directory as the Flex SDK -- the library is available here [http://www.adobe.com/cfusion/entitlement/index.cfm?e=flex3sdk]
    I must say I am also confused, because as far I can tell data visualization component is not included in 3.3, but SAP makes no mention of this. Hopefully someone else can enlighten us on this issue?

  • Adobe Flex & Flash

    Hi,
    I have a question about Adobe Flex. I have a project about preparing a digital content (i am planning preaper it at flash and compatible with SCORM 2004). I need to know that can i connect a content prepared with Adobe Flash CS4 to Flex?
    And if yes, how can i do it. I dont know Flex much
    Thank you.
    Nilay P.

    > I am Working as Consultant-SAP.I am creating static Forms using Adobelive
    > Cycle Designer and SAP.
    >
    > How Adobe Flex is useful to create Forms?
    Yes very.
    > Is it usefull for me if i learn Adobeflex?
    Several of us are turning to Flex for eLearning and we are finding it to be
    a great tool.
    > How will be the future with ADOBE FLEX?
    I think Adobe are commiting heavily to Flex - Flex plays on any machine with
    the latest Flash player , so that includes PC, Mac and Linux. AIR plays on
    PC and Mac today, with a Linux version under development right now. In the
    future (Open Screen Project) versions of Flex and AIR should play on mobile
    devices too.
    >
    > I have seen the article SAP WebDynpro + Adobe Flex/Flash = Enterprise UI
    > 2.0.
    > Working as ABAPer shall i shift to Adobe Flex?
    I don't really know what would be good or bad for your needs. Take a look at
    some of the sample Flex and AIR apps on Adobe.com and see if you think the
    features demonstrated are applicable to your needs.
    Steve
    http://twitter.com/Stevehoward999
    Adobe Community Expert: eLearning, Mobile and Devices
    European eLearning Summit - EeLS
    Adobe-sponsored eLearning conference.
    http://www.elearningsummit.eu

  • Load Flex/Flash Builder project in Flash Professional CS5

    Is there a way that I can load (or export) Flex/Flash builder project in Flash Professional CS5?
    As it turns out we got Flash Prof for our team, but it may look like we actually need Flash builder to build lots of UI related stuff..

    Specifically, I want to use flex chart in CS5. Is there a way to do this?
    Message was edited by: bart2335658
    And flex ui

  • Is it possible to get post or Get variables into a flex applicaition without messing with the flashvars?

    Is it possible to get post or Get variables into a flex
    applicaition without messing with the flashvars?

    Probably externalInterface, and maybe BrowserManager.
    But both of those are much harder and messier than flashvars.
    Why are you trying to avoid the easy way?

  • Qn:OpenGL or similar support in Flex/Flash?

    i am to develop an engineering simulation application that
    runs on web as well as on destop. i am exploring the possibilities
    of using Flex/Flash, & AIR. but i am not getting any
    information on support to OpenGL or similar thing by
    Flex/Flash/AIR. my application will have a graphic window to show
    lines, curves, etc in 3d view. It should also offer pan, zoom.
    rotate etc functionality.
    can Adobe give me all these functionalities?

    The Macintosh implementation of the Flash Player on MacOS X
    10.2+ since Flash Player 8 uses OpenGL hardware acceleration.
    In Flash Player 9 Upadate 3, OpenGL is used for hardware
    acceleration of the fullscreen mode on the Mac.
    On PC, the fullscreen mode uses Direct X.
    So, you can't directly access OpenGL functions but new
    releases of the Flash Player like Astro (Flash Player 10) will use
    it more and more for hardware acceleration of 2D and 3D rendering.

  • SAP WebDynpro  +  Adobe Flex/Flash  =  Enterprise  UI 2.0

    Hi Frens...
    I am Working as Consultant-SAP.I am creating static Forms using Adobelive Cycle Designer and SAP.
    How Adobe Flex is useful to create Forms?
    Is it usefull for me if i learn Adobeflex?
    How will be the future with ADOBE FLEX?
    I have seen the article SAP WebDynpro + Adobe Flex/Flash = Enterprise UI 2.0.
    Working as ABAPer shall i shift to Adobe Flex?
    Please Suggest me.
    Regards
    Bhuvana

    > I am Working as Consultant-SAP.I am creating static Forms using Adobelive
    > Cycle Designer and SAP.
    >
    > How Adobe Flex is useful to create Forms?
    Yes very.
    > Is it usefull for me if i learn Adobeflex?
    Several of us are turning to Flex for eLearning and we are finding it to be
    a great tool.
    > How will be the future with ADOBE FLEX?
    I think Adobe are commiting heavily to Flex - Flex plays on any machine with
    the latest Flash player , so that includes PC, Mac and Linux. AIR plays on
    PC and Mac today, with a Linux version under development right now. In the
    future (Open Screen Project) versions of Flex and AIR should play on mobile
    devices too.
    >
    > I have seen the article SAP WebDynpro + Adobe Flex/Flash = Enterprise UI
    > 2.0.
    > Working as ABAPer shall i shift to Adobe Flex?
    I don't really know what would be good or bad for your needs. Take a look at
    some of the sample Flex and AIR apps on Adobe.com and see if you think the
    features demonstrated are applicable to your needs.
    Steve
    http://twitter.com/Stevehoward999
    Adobe Community Expert: eLearning, Mobile and Devices
    European eLearning Summit - EeLS
    Adobe-sponsored eLearning conference.
    http://www.elearningsummit.eu

  • UC 220 M3 with Flexi Flash

    I just got in 6 UC220 M3 servers with the new Flexi flash option.
    There is documentation out from cisco that states to use Flexi Fash to store your vmware boot files.
    Here are the documents that I have reviewed on the cisco web site.
    http://www.cisco.com/en/US/solutions/collateral/ns340/ns517/ns224/ns944/white_paper_c11-718938_ps10493_Products_White_Paper.html
    Then here are the server install instructions on the UC220m3 server and itsays to install vmware on the raid 5 disk array...
    http://www.cisco.com/en/US/docs/voice_ip_comm/cucm/virtual/CUCM_BK_CA526319_00_cucm-on-virtualized-servers_chapter_00.html#CUCM_RF_C38CF3EA_00
    The TAC best practices doesnt even mention the Flexi Flash/disk.
    Anyone have a recommendation?
    TIA

    I just got in 6 UC220 M3 servers with the new Flexi flash option.
    There is documentation out from cisco that states to use Flexi Fash to store your vmware boot files.
    Here are the documents that I have reviewed on the cisco web site.
    http://www.cisco.com/en/US/solutions/collateral/ns340/ns517/ns224/ns944/white_paper_c11-718938_ps10493_Products_White_Paper.html
    Then here are the server install instructions on the UC220m3 server and itsays to install vmware on the raid 5 disk array...
    http://www.cisco.com/en/US/docs/voice_ip_comm/cucm/virtual/CUCM_BK_CA526319_00_cucm-on-virtualized-servers_chapter_00.html#CUCM_RF_C38CF3EA_00
    The TAC best practices doesnt even mention the Flexi Flash/disk.
    Anyone have a recommendation?
    TIA

  • Does Flex/Flash Builder allow me to do this?

    Hi, I have a scrolling gallery element that I built in Flash and then imported to catalyst as part of my website. (I'm an artist who is self-taught in the realm of web-building and maintain my own site.)  When I add new images, I end up opening my .fxp file in catalyst and then take that flash element back in Flash and add images, and then export the whole thing as a .swf and then update that file for my site.
    Can using flex/flash builder some how stream line my process where I am instead updating data. i.e. adding new images to a database, which then gets pulled in?
    Also I have text fields that require frequent updating, it would be much easier to simply update a document that gets pulled into the final output.
    Mainly I'm confused on the purpose of flex and flash builder, and am just wondering if it is something I should know in a limited way to make things easier.
    Or is there a much easier way to do this all within catalyst without the round-trip to flash? Should this be a "datalist?"
    if you want to see what I'm working with you can visit my site:
    www.timothymcmahon.com
    the gallery component is reached by clicking on either of the two circles on the lower left after entering the main page.
    Thanks, Tim

    Don't use FlashBuilder for making a gallery. Much better to google "Actionscript xml image gallery" there are a ton of solutions out there.

  • Flex Flash event call

    Ok, this is probably going to be a little confusing, but Im
    still relatively new with Flash/Flex2 so Ill do my best. I have an
    Flash asset which is a map of the United States. The asset has its
    own actionscript file that handles the mouseover, mouseout, etc
    events. No, I am trying to use this asset in a flex application as
    a means for users to click on a state and see a list of postings
    from that state. So far, all this works great.
    Now, what I want is to have the flex query a web service and
    compile a list of all the states that currently have postings and
    then have the map show a different color for those states.
    I'm not really sure if I need to create a property in the
    flash actionscript file and call that from the flex, or what. I
    want my application to be loosely coupled and I was thinking I
    could have flex dispatch an event but I dont know if the Flash
    Asset is able to capture the event and then use it to turn the
    appropriate states on.
    Is there a better way to handle this? I like having the
    assets handle their own behavior and contain the methods to perform
    the switch, but I dont what is a good way to implement this.
    Thank you all SO MUCH!!!

    I couldn't use 'complete' becouse then the function doesn't execute. For example:
    <mx:SWFLoader id='flashMCinstance' source='{myMC}' complete="loaderCompleteHandler"/>
    private function loaderCompleteHandler (event:Event) :void
         flashMCinstance.content.addEventListener('myEvent', myFunction);
    or
    <mx:SWFLoader id='flashMCinstance' source='{myMC}' complete="loaderCompleteHandler () "/>
    private function loaderCompleteHandler () :void
         flashMCinstance.content.addEventListener('myEvent', myFunction);
    doesn't execute this function, but the creationComplete="loaderCompleteHandler()" with loaderCompleteHandler():void work. I don't know why, becouse I can see the MC on stage loaded, so it should be completed by then.
    In debugger I see that content variable of this SWFLoader is "nameOfMyApp_myMC" - the 'myMC' is class name for source of this SWFLoader. So it appears that everything is ok, but it still doesn't work.

  • Integrating Flex/Flash in Web Dynpro ABAP(Netweaver 7.0) need info!

    Hi all,
            I need to embed a flash or a flex object inside a web dynpro abap application.I am working in Netweaver 7.0 and i don't have enhancement pack 1 installed.Is it possible ?   If it is possible can anyone please provide me the coding and configuration details.
    Thanks,
    Saikat

    I'm afraid that the SAP supplied integration technology - call FlashIslands - is only available from NetWeaver 7.01 and forward.  You could perhaps do some simple integration (very little data transfer) with the iFrame UI element - although the iFrame is deprecated in 7.0 and 7.01, but does return to full support in 7.02.  The other option would be to use the NetWeaver Portal or NetWeaver Business Client and have two iViews within the page. One iView would have WDA and the other some external technology (BSP, JSP, etc) to host the Flash/Flex content.  Not tight integration, but you could potentially use Portal Eventing to at least communicate events.

  • Looking for a Great Flex/Flash Engineer

    Hi All,
    Apologies if this isn't an appropriate place for posting such a request, but I'm a long-time user of Adobe Flash and Flex. Despite the uncertainty surrounding the future of Flash and Flex we feel it's still the best platform for delivering rich Internet applications. We're on the hunt for a couple great engineers to join our team, and we're thinking some of you might be on the looking for positions that allow you to leverage your Flash and Flex development talents.
    Information about the UI position is included below. Please check out http://coincident.com for more information about us and to see our other posting(s).
    Thanks!
    -jmh
    President & Founder
    Coincident, Inc.
    User Interface  Engineer
    Coincident. We’d like to  make it a household name but we’re going to need your help! We’re a small clean  energy company in Boston, Massachusetts and we’re developing an  automated energy management platform for residential and small commercial  energy consumers.
    We think it’s a potential  game-changer amongst a sea of competing interests and apparently so does the U.S.  Department of Energy. They’ve backed our engineering efforts with innovation  research grants to help us commercialize our technology.
    We’re on the hunt for a  talented programmer with the ability to fuse design and technology like no  other. You’ll help craft the user interface components that make our energy  management system the most attractive and easy-to-use on the market.  Ease-of-use, visual appeal, and intuitive behavior will be your raison d’être. Bring  a passion for energy efficiency, rich internet applications, consumer  electronics, and mobile development platforms.
    This is a paid full-time position  offering compensation and equity options commensurate with your experience and ability  to make significant contributions to the development of our product.
    If this sounds like a job  you’d love, keep reading to see what we’re looking for.
    Does this sound like you?
    Talent  for developing dynamic and rich Internet applications
    Experience  with Adobe Flash, Flex, HTML 5, and JavaScript
    Versed  in UI development best-practices and supporting technology frameworks
    Knack  for implementing elegant user interface controls and components
    Unparalleled  ability to anticipate user behavior and response to designs
    Ability  to work and collaborate effectively with creative and technical teams
    Experience  integrating web services and Java server-side technologies
    Aptitude  for mastering new technologies in short periods of time
    Ability  to work autonomously on new product features with minimal instruction
    Proficiency  with vector and bitmap graphics libraries, applications, and tools
    Extra  credit for mobile development skills for iOS and Android platforms
    Coincident is located near  South Station in Boston’s Innovation District and is a member company of Greentown Labs, Boston’s first and only clean technology incubator. Resumes and cover letters should be addressed to [email protected].
    United States Citizens and Residents  only, please.

    Another option: I bought a nice one at REI for PWB in March, and now use it for MBP. Has space for my wacom tabet and also small 3x5 or so firewire HD, and of course power adapter and misc stuff. notebook compartment can be removed and carried separately. Very happy with it.
    George

  • How to get value of process variable in another flex form

    Hi,
    currently we are using Flex 3 for form development in LiveCycle ES workspace.
    We have got an "Assign Task" service operation. This service operation has got a process variable defined for "input" and "output".
    The service will be called in a flex form. When the process is called a task will be sent to a user.
    When the user opens this task another flex form will be opened. All these steps work fine!
    How it's possible to get the value of the defined process variable from the first flex form (which starts the process)
    to the flex form which will be displayed when the user opens the task?
    Thanks very much for your help!
    Holger

    Solutions:
    -The 'proper' way for application specific stuff is to use a properties file, not env vars.
    -Use System.getenv(), only works for versions before 1.3
    -Use the java command line option '-D'
    -Use Runtime.exec(), similar to the way you suggested.
    -Use JNI.

Maybe you are looking for

  • SOAP RECEIVER - no soap envelope sent

    Hi I am new to soap. When sending the SOAP request via the SOAP RECEIVER commchannel - the partner only reveives a plain xml with no SOAP-ENV. My comm channel settings are as follow: URL is set to the url of the receiver No other settings is marked.

  • Data load in BI7 for an single infoobject

    Hi   I had added a new info object (PO number) in ODS and mapped to the corresponding R/3 field (BSTNK). Now i want to load data only to the newly added field (PO number) in BW from R/3 with out deleting the existing data. I came to know it is possib

  • Bib-9509 and ora-00932

    The cube view throws these exceptions when I create a hierarchy that includes levels specified by columns with different datatypes. Two of them are numbers, one char. This is farely legal, isn't it? I have created another number column and mapped the

  • Planning tolerances during MRP

    Situation is I create a sales order for 100 on a finished material. Currently I have a 0 stock. MRP creates a planned order for 500 which I convert to production order. On the first operation step of the production order confirmation I final confirm

  • SU25 - Step 2B Missing changes

    Dear All, We are upgrading our system from R/3  Enterprise to ECC6.0. After the upgrade in the development system, I have run SU25. In Step 2B, the transaction SM59 was not showing in the list of affected transactions but during the testing we found