0 Replies Latest reply on Jun 9, 2008 8:40 AM by trafalmadorian

    Creating a custom component is causing a strange scoping issue

      I am a fairly new user to Flash and Actionscript, but I have a fair amount of experience working with C and Java. I'm currently working with Actionscript 2 in Macromedia Studio 8. I was trying to create a new component for a project I am working on, and I followed the tutorial in the help and all testing works while I am in context of the flash document where I export the component from. However, I try testing my component in a new blank document and I get some strange behavior.

      I am able to create a component on the stage, and adjust the properties perfectly fine. However, when I test the file, the variables for colors go out of scope. That is, the adjustments I made to the component through the parameters panel, and saw updated on the stage aren't demonstrated at runtime. The Number variable I used however is preserved. I did some traces, and it appears that this is happening because at runtime in the new blank document, the variables in the onEnterFrame method go out of scope, where they weren't before.

      It seems really strange to me that I should be able to edit the color on stage but have it revert while it is running. My intuition says that if it wasn't going to work in the new document, that it shouldn't work in either case.

      Anyway, here is the code for the .as file, I hope I'm just doing something stupid.