Question about global variable scope in mxml

Let's say I have two files, myApp.mxml and EntryClass.as, as
attached at the end of this post.
Why does mxmlc complain with this error message:
quote:
/path/to/EntryClass.as(4): col: 7 Error: Access of undefined
property myChart.
myChart.graphics.drawRect(100,100,100,100);
^
According to devguide_flex3.pdf,
quote:
The IDs for all tags in an MXML component, no matter how
deeply nested they are, generate public variables of the component
being defined. As a result, all id properties must be unique within
a document. This also means that if you specified an ID for a
component instance, you can access that component from anywhere in
the application: from functions, external class files, imported
ActionScript files, or inline scripts.
So how does one reference these public variables?

"slinabery" <[email protected]> wrote in
message
news:gbtnji$f03$[email protected]..
> Let's say I have two files, myApp.mxml and
EntryClass.as, as attached at
> the
> end of this post.
>
> Why does mxmlc complain with this error message:
>
quote:
/path/to/EntryClass.as(4): col: 7 Error: Access of undefined
property
> myChart.
>
> myChart.graphics.drawRect(100,100,100,100);
> ^
>
>
> According to devguide_flex3.pdf,
>
quote:
The IDs for all tags in an MXML component, no matter how
deeply nested
> they
> are, generate public variables of the component being
defined. As a
> result, all
> id properties must be unique within a document. This
also means that if
> you
> specified an ID for a component instance, you can access
that component
> from
> anywhere in the application: from functions, external
class files,
> imported
> ActionScript files, or inline scripts.
>
> So how does one reference these public variables?
>
> myApp.mxml:
>
> <?xml version="1.0"?>
> <mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
> applicationComplete="EntryClass.main()">
> <mx:Panel>
> <mx:VBox id="myChart" width="900" height="300" />
> </mx:Panel>
> </mx:Application>
>
> EntryClass.as:
>
> package {
> public class EntryClass {
> public static function main():void {
> myChart.graphics.drawRect(100,100,100,100);
> }
> }
> }
http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf
Third question.

Similar Messages

  • Question about global variables in Netbeans 4.1's debugger

    so i can see the local variables, great.
    how do i display the global variables when im debugging? searched help, nothing, searched the netbeans site, nothing.
    anyone know?

    I haven't used the 4.1 version of the debugger (I can't get it to work on a single file/class) but under 3.6 you just put the cursor over them and the values is in the tooltip.

  • Question about Local Variables (Multiple answers welcomed!)

    A couple of questions about Local Variables
    1. Programmers always say: “Do not abuse of Local Variables”. I’d like to know, when and where Local variable are most efficiently used?
    2. If I have to create a couple of local variables, is there anyway to “clone” them without going through the repetitive “create/local variables” mouse click each time? (When I try to copy and paste, it creates a new variables instead of the one that I am trying to reproduce)
    3. Which is faster in execution: Updating a variable through a) writing to property node/value or b) through local variable
    Everyone’s input is welcomed, so if this question is already answered, please
    feel free to add additional comments/answers!

    1. Use Local Variables in user interface code and no where else. The only exception is using a local variable of a cluster output to define the datatype for a bundle by name node.
    2. You can drag copy them then right click to get to a menu of all the currently defined controls and indicators on the VI.
    3. B. The problem with A is that it forces a thread switch to the user interface thread--which can take time if you aren't already in it, and it's a very convoluted process under the hood. NI's advice never update indicator values through a property node unless you absolutely, positively can't figure out some other way of doing it.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • About global variables in forms personalization

    Hi all,
    I did forms personalzation based on global variables.
    When when i login for the first time untill and unless i validated the global variables the following error is displaying.
    Tokens in the string could not be evalated. please check the syntax.
    Once i validated the global variables then it will working fine.
    Did any of you have faced this problem please let me know the solution.
    Thanks and Regards
    Zaheer.
    Edited by: zaheer on Feb 5, 2010 1:23 AM
    Edited by: zaheer on Feb 5, 2010 1:24 AM

    Hi again;
    In addition to above please check:
    Form Personalizations in Oracle E-Business Suite (Release 12) [ID 395117.1]
    Information About the Oracle Applications Form Personalization Feature in 11i [ID 279034.1]
    Hope it helps
    Regard
    Helios

  • Question about session variables and binding

    Hi All,
    I'm a newbie with Application Express. I've gone through several tutorials and a book, and now I'm actually getting started with apex. My first adventure is a tiny little form, where all you do is fill it out and it sends an email. Pretty simple.
    And, i have it working just fine - but I have a question about something I don't quite understand. Basically, I am generating the email text in a page process. And some of the form fields work fine if i reference them as *:ACCT_NAME*, but some give me the dreaded "not all variables bound" error. For the ones that give me the error, I can reference them like V('ACCT_NAME').
    So, as a newbie, I'm a little confused. When is it appropriate to use the V function, and when it is appropriate to use binding? Why would one of the fields work with binding but not another from the same form?
    Thanks for any clarification you can offer,
    Lisa

    Lisa,
    A bind variable is a place holder variable available in an environment.It is used quite frequently(outside Apex Context) in SQL and PLSQL scripts and especially in Dynamic SQL statements.Many times using a bind variable gives better performance. In the Apex environment,page items and many other variables related to the session are available as bind variables and hence their value can be referred in SQL,PLSQL contexts as :VARIABLE_NAME.
    Now V() function is an apex specific function which returns the value of an apex session variable outside the apex environment. So as Machaan pointed out, it is used in
    procedures and triggers that gets called from within an apex session. This is required since the bind variables themselves are not directly available in the SQL environment but their values from the corresponding session can be accessed by this apex built-in function.
    The length of any Bind variable name is limited to 30 characters, this is a limitation inherited from Oracle SQL itself and hence session variables(page or application items) whose name has a length which exceeds 30 characters cannot be used as the :ITEM_NAME format. In such cases you would have to use the v() method again. This might be happening in your case.

  • Newbie thread about global variables and result set

    Hello everyone this is my first post, im from colombia and now im learning about this world !! the WCC !!
    Now im doing a practice but im so noob that i cant get it so far... i wrote some of the oracle documentation.. and it was so usefull for starting.. but now im trying to do custom components builded in java + resources + services + template etcc .. all good stuff :D.
    i want to retrieve a result set coming from a custom service ... and then i want to store this result set in some kind of global variable !! why ? because i want to use this data from the result set again and again without making more call to the service !!
    ive tried to copy this resultset but i think it cant be done because i use a popUp window to display the rows from the RS.. and when i close the window .. it dies!!
    i want to use this RS for 3 custom metadata field.. but i have no idea how to do this....
    this is a part of my custom resource
    <$if fieldName like "xElaborador"$>
    <$executeService("SERVICE_ALLUSERS")$>
    <$trace(" ### executing service ###","#log")$>
    <!--i tried to copy the rs here but this is wrong i guess -->
    <$nuevoRS="usuarios_LDAP"$>
    <$endif$>
    <!-- usuarios_LDAP is the RS parameter coming from the java calss -->
    <$if rsExists("usuarios_LDAP")$>
    <$if rsFirst("usuarios_LDAP")$>
    <$loop usuarios_LDAP$>
    <$trace(" ### inside RS ###","#log")$>
    <$include each_user_LDAP$>
    <$endloop$>
    <$else$>
    <$include therearenotusers$>
    <$endif$>
    <$endif$>
    <!-- THIS CODE IS USELSS BASICALLY-->
    <$if fieldName like "xRevisor"$>
    <$if rsExists("nuevoRS")$>
    <$if rsFirst("nuevoRS")$>
    <$loop nuevoRS$>
    <$trace(" ### inside rs for revisor ###","#log")$>
    <$include each_user_LDAP$>
    <$endloop$>
    <$else$>
    <$include therearenotusers$>
    <$endif$>
    <$endif$>
    <$endif$>
    pls tell me if im too lost im all ears to learn the good practices for this tool.

    Hi ,
    One of the good resource on this topic is :
    http://jonathanhult.com/blog/2012/11/resultset-versus-dataresultset/
    Thanks,
    Srinath

  • About global variables

    can any one please help me how to declaru and use global variables in oracle forms. i want to pass the details entered in one form to another form. i am unable to do this.
    please some one say how to do this.

    vivek
    you have to use following keyword to declare a Global variable with no datatype
    :GLOBAL.VARIABLENAME
    you may initialize the global variable with your text filed or some stativ value like
    :GLOBAL.VARIABLENAME := :Field

  • Question about global context.

    Hi.
    I have this scenario:
    1) Context set within the application:
    a) user logins and identifies basic context info: company id, etc.
    b) Context is set in a package
    b) Views are the underlying datasource for application and they are created using context info. For example:
    Create view some_view as
    select * from some_table where company_id =sys_context('access_control_ctx','company_id')
    2) This works perfectly in a dedicated / persistent connection. However if ones tries to use connection pooling, like in a Web app, say Apex , this won't work as expected.
    3) An alternative is to use global context. However i have this question:
    (a) User a logs in to application and set values for company 1.
    (b) User b logs in to application and set values for company 2.
    How does global context works in this situation?. I mean, since every user needs a different value form company_id? How can one guaranties they both will point to their respective value without having to change the application security / access control?.
    Regards, Luis ...!

    Specific to APEX, you can use the v function to access APEX session state information (i.e. v('APP_USER') to get the currently logged in application user).
    If you are going to use a global context, you would need a session ID (or something similar) that is stored as a part of the global context to determine which session you are interested in. The global context would have A's data with A's session ID and B's data with B's session ID and before you get the context information, you would need to specify which session ID you are asking about.
    Tom Kyte has an example of using a global context
    Justin

  • Question about shared variables and report generator

    I have a project with about 200-250 shared variables and at every 12 hours i want to make a report containing information about some boolean and double front panel variables linked to the shared variables... Now, i've tried with both the "Write Trace to SpreadSheet File" function from DSC->History and with different functions from NI Report Generation Toolkit. My problem is this: i would like to get my xls file to contain just the timestamps when my shared variable changed value. As it is, the number of rows in the file depends, obviously, on the sampling interval given as input. As an example, in 12 hours, my shared variable would change value maybe 5-6 times. Thus i would like my xls file to contain just 5-6 rows with those 5-6 changes. If i set the sampling interval to say, a matter of seconds, that would mean too much unneeded information in my xls file. Instead, if i set it to let's say 15 minutes, i would probably lose the moment the shared variable changed value. Is there a way for me to achieve my desired functionality with functions from DSC or Report Generation Toolkit? Thanks in advance, Sabin 

    Hi Mike and thanks for the reply. Actually, my first idea was exactly this: in an event case structure, whenever my variable changed value, i would retain the relevant data in an array and then at the 12 hour period write all of it in a report. However, my boss deeemed it memory unefficient and compelled me to use only one function. Thus my predicament... If you have more advice on this new info, i would be grateful... Cheers, sabin

  • Data binding working ... now a question about the variables

    I wrote a small app based on the example (below) from sapui5.hana.ondemand.com.
    My question pertains to anyone else that has data binding working and has tried to do something like the text in red.
    When stringing together "variables" like the ones highlighted in below ... if I do something similar all I get on the screen is the actual text, ie {Width} instead of the value that should replace that.  If I get rid of the extra text and just have the variable in " " I get the correct value displayed for the "variable"
    Anyone else ran across this?
    -Mike
    var header = new sap.m.ObjectHeader({
      title : "{Name}",
      number : "{Price}",
      numberUnit : "{CurrencyCode}",
      statuses : [
      new sap.m.ObjectStatus({
      text : "Some Damaged",
      state : "Error"
      new sap.m.ObjectStatus({
      text : "In Stock",
      state : "Success"
      attributes : [
      new sap.m.ObjectAttribute({
      text : "{WeightMeasure} {WeightUnit}"
      new sap.m.ObjectAttribute({
      text : "{Width} x {Depth} X {Height} {DimUnit}"
      new sap.m.ObjectAttribute({
      text : "{Description}"
      new sap.m.ObjectAttribute({
      text : "www.sap.com",
      active : true,
      press : function () {
      sap.m.URLHelper.redirect("http://www.sap.com", true);

    Thanks for the reply Chandra,
    To clarify a bit more, I have a list object and have successfully been able to bind a model to it.  When I create a list item to put in the list I can display the correct values using the same syntax as above, ie {Width}
    So I am not binding the model to the items in the list rather to the list itself then referring to fields that are available in the model using the syntax {Width} ... and this works fine ... until I try and add some additional text like {StgeBin} in the example below (I am including myHeader in the list that has a model bound to it):
    var myHeader = new sap.m.ObjectHeader({
            title : "Bin # {StgeBin}",   //This shows the text --> Bin # {StgeBin}  ... rather then Bin # 123  (which is what I want)
            //title : "{StgeBin}",        This works and will show the bin number as I expected ie 123
            statuses : [
              new sap.m.ObjectStatus({
                text : "Some Damaged",
                state : "Error"
              new sap.m.ObjectStatus({
                text : "In Stock",
                state : "Success"
            attributes : [
              new sap.m.ObjectAttribute({
                text : "{StgeLocDesc}"
              new sap.m.ObjectAttribute({
                text : "{Material}"
              new sap.m.ObjectAttribute({
                 text : "{MaterialDesc}"
    I took this example right from the SAPUI5 documentation and it works great, just can't add additional text inline with my variables.

  • Question about bind variables.

    Hi,
    I'm looking to do an oracle prepared statement in some code and I'm having issues with the bind variables. If I have this query:
    SELECT count(*) FROM accessp WHERE id IN (?) AND groupies LIKE \'%?%\'
    and I want to bind a list like this:
    2,4,6
    to the first ?
    and a value like this:
    cap
    to the second ?
    it seems as if it would work but I keep getting errors about oracle not seeing the bind variable. After some doing a little research I found that it looks like I need to create a type or types for my columns I'm doing the binding to.
    Is that correct?
    Any help, greatly appreciated.
    Thanks,
    Jon

    No, that doesn't work. Unfortunately this is one of the few times when PreparedStatements are inconvenient.

  • Question about global temp tables

    I have global temporary table with ON COMMIT setting ON COMMIT PRESERVE ROWS. E.g.:
    CREATE GLOBAL TEMPORARY TABLE admin_work_area
            (startdate DATE,
             enddate DATE,
             class CHAR(20))
          ON COMMIT PRESERVE ROWS;On application start procedure inserting data into table, on application end is DELETE statement used to make table empty.
    Interestingly if application is started again (in same session!) deleted rows appear again in table before call of insert-procedure. So after call of insert-procedure data will be doubled... :(
    So my question is:
    Does COMMIT in this constellation making ROLLBACK of deleted rows?
    Sounds unlogical to me, but appear to be like that...
    Message was edited by:
    Faust
    Edit: ON COMMIT setting

    Are you sure that the rows somehow just appear back
    and it's not the application which inserts them
    twice.Yes I'm sure, there is only one call of insert-procedure (on application start).
    Are you using autonomous transactions for
    those inserts by any chance?No.
    SID is just an index into session fixed array, so the
    only way to get the same SID in an instance is when
    the previous session ends.
    Each session array slot contains a SERIAL# field
    which is zero at instance start and is incremented
    every time the slot is reused by next session.
    So, as long as your session exists, it is impossible
    that someone else gets same SID + SERIAL# combination
    in an instance.
    Note that the SESSION_ADDR and SESSION_NUM give you
    the address and SERIAL# of the session owning a
    temporary segment.Original session exist...
    Thank you Tanel for your replay!

  • Questions about authorization variable customer user exit

    Dear all,
    To reduce the authorization maintenance effort, I found from the web that we can use authorization variable with customer user exit RSR00001.
    When I use the transaction CMOD to display the maintain the user exit RSR00001, the user exit does not found. I would like to know how can I use thie user-exit?
    My SAP version is R/3 4.7
    The information of authorization variable  from web is as follow:
    http://help.sap.com/saphelp_nw04/helpdata/en/6d/58f438114ee836e10000000a114084/frameset.htm
    Would anyone have some ideas to solve my questions?
    Many thanks
    Sunny
    Edited by: LI Sunny on Aug 3, 2010 12:08 PM

    Dear Bala Duvvuri,
    Firstly, many thanks of your reply.
    Actually, what I want to do is to call some user-exit when performing authorization checking. I want to add some logic to the authorization checking and the user exit can be called automatically when performing authorization checking.
    I mainly use this checking in the FI module.
    Are there any ways I can perform this checking?
    One more findings, I have another machine containing SAP XI, I can search the user exit RSR00001. but it doesn't exit in SAP R/3 4.7. Is it version issue or my SAP R/3 4.7 doesn't contain the BI module?
    Many Thanks again.
    Sunny

  • Question about Global index and Table Partitions

    I have created a global index for a partitioned table now in the future the partitions will be dropped in the table. Do I need to do anything to the global index? Does it need to be rebuilt or would it be ok if partitions get dropped in the table?

    >
    I have created a global index for a partitioned table now in the future the partitions will be dropped in the table. Do I need to do anything to the global index? Does it need to be rebuilt or would it be ok if partitions get dropped in the table?
    >
    You can use the UPDATE INDEXES clause. That allows users to keep using the table and Oracle will keep the global indexes updated.
    Otherwise, as already stated all global indexes will be marked UNUSABLE.
    See 'Dropping Partitions' in the VLDB and Partitioning Guide
    http://docs.oracle.com/cd/E11882_01/server.112/e25523/part_admin002.htm#i1007479
    >
    If local indexes are defined for the table, then this statement also drops the matching partition or subpartitions from the local index. All global indexes, or all partitions of partitioned global indexes, are marked UNUSABLE unless either of the following is true:
    You specify UPDATE INDEXES (Cannot be specified for index-organized tables. Use UPDATE GLOBAL INDEXES instead.)
    The partition being dropped or its subpartitions are empty

  • Very simple question about declaring variables

    if a create a new ' int ' as in the code below :
    static int counter;
    does the value of counter automatically default to ' 0 ' ?
    Does this also apply if i declare the var to be public, protected etc ( but not final )
    thanks

    Most languages will initialise an int to 0 if no value is specified but it is dangerous to rely on this as it is not always the case. It is therefore recommended as good practice that you always initialise your own variables to ensure they start with the value you wish and not something unexpected.
    Mark.

Maybe you are looking for

  • WM Process flow

    Hi, What are the settings are required for extending the WM module in our Plant. Could you please tetll me the process  flow and transaction code , movement types to be used in WM scenarios. Please do the needful. Thanks.

  • Clustering, ServletContext

    Is there no way to insure that ServletContext is propagated across a cluster           in Weblogic 6.1 sp1 without using another product? I am trying to make a           cache of some data that will be available to all servlets in a cluster The      

  • HT3743 how can i get my iphone working asd it was jail broke and wont restore

    I swapped my blackberry for an iphone 3gs. I have been told its jailbroke. could someone please tell me how to take it off, i have tried itune and it say i have an error on the phone. i dont know what else to do. Thank you

  • Precision of the SUM Funtion

    I am writing a simple query using SELECT SUM(l.ledger) as part of the SELECT statement. I am getting the correct number except it has a precision of 8, no scale. IE: number should be 1000000.72 and I'm getting 1000000.7. The column in my table is NUM

  • My ipad. Has. Malware. Flash player update. On safari

    http://imageshack.com/a/img208/856/sbqp.jpg http://imageshack.com/a/img62/6586/f76i.jpg How To remove from. iPad. ;(