How can I save static data on custom component?

Ask a Question related to Macromedia Flash Actionscript, Design and Development.

  1. #1

    Default How can I save static data on custom component?

    Hello.

    Did Flash ActionScript support static variable?

    At Frame1, I create a instance of S_List ( Me created custom component),
    named "lstOne", user select the 2nd item, (saved at a variable "idxSelected")
    , then gotoAndPlay(5), jump to Frame5, do something... then, jump back the
    Frame1, the selected value is lost, because the "idxSelected" is a variable of
    S_List component. so it be init again when the Frame1 be showed.

    So. I move the "idxSelected" var to #initclip...#endinitclip, as a global
    variable, IT RUN OK. the selected item is right.

    BUT, If I create another instance of S_List, named "lstTwo", at Frame5, and
    selected the 3th item of "lstTwo", then back to Frame1, the "lstOne" 's
    selected item is changed by Frame5's "lstTwo". because the "idxSelected" is a
    global variable.

    How can I save the "idxSelected" value to a static field, It don't be init
    again and don't be changed by another instance.




    sharetop Guest

  2. Similar Questions and Discussions

    1. custom component and custom data
      what I would like to have: I would like to build a custon component, that is display N times in the application, because there are N tags in an XML...
    2. Static Data for Localization
      I am trying to create a file of localized text values (that are static) to be used in both an ActionScript class and a MXML component. By putting...
    3. SQL: Inserting data from table1 with static data into table 2
      Hi, I'm trying to create an SP in SQL Server 2000 that will read in a load of row values and insert them, along with two static values, into...
    4. Custom Component and Custom Textbox binding
      Hi, I am trying to accomplish the following. Here is what I want to do: 1. Drop a custom business object component onto the design surface...
    5. Binding to a Custom Component from a Custom Control
      I have been experimenting with attaching a component to a custom control as a property. The property grid correctly lists the available...
  3. #2

    Default Re: How can I save static data on custom component?

    look at SharedObject.getLocal(..)

    it put the values on the user hard drive.

    Z = SharedObject.getLocal("myappname");

    if ( Z = !inited ){
    Z.data.firstvar = 1;
    ...
    }

    --

    Pierre Alain

    com


    "sharetop" <com> a écrit dans le message de
    news:c29ekd$1lc$macromedia.com... 
    "idxSelected") 
    the 
    variable of 
    global 
    and 
    is a 
    init 


    PierreAlain Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139