3 Replies Latest reply on Sep 22, 2011 5:05 PM by Adam-C

    Baffling Flash component behavior

    bd525

      I am having to rebuild two large projects because of the now complete non-viability of OSControl. I have discovered buttons and checkboxes of the "Flash component" variety, which appear to be superior to the crude Director controls (better looking, can be enabled/disabled through Lingo, I don't have to develop and implement my own graphics, mouseOver and click actions don't have to be coded, etc.). Alas, though, I'm having troubles with them that many wasted hours of experimentation and reading of documentation have not solved, hence this post.

       

      Various strange things happen:

       

      1) Sprites disappear, even though Director says they're visible.

      2) Push buttons stay in mousePressed state (light green tinge) and won't return to basic state.

      3) Sometimes a click will initiate the proper actions from the behavior, but then Director seems to freeze up, as if a fatal loop is running somewhere. A click on one sprite unfreezes things, but I have no idea why that one and not another one.

       

      I'm not using any actual Flash content; haven't worked with it at all. Just using these buttons for basic user interaction, with Lingo code in "on click me" behaviors.

       

      I expect there may be simple solutions, but I'm just way tired of wasting time trying to figure out these problems, and I dread starting again from scratch on these major rebuilding projects.Is there something about these components that is simply inappropriate for the uses to which I am putting them? I appreciate any helpful pointers.

       

      P.S. This is a repost; got no input the first times, just hoping the right person will see this on retry. Thanks for your patience! :-)

        • 1. Re: Baffling Flash component behavior
          Adam-C Level 2

          Are you applying code to the buttons via behaviours or via member scripts? (Just in case, a behaviour is attached to the sprite whereas a member script is contained in the cast member itself).

           

          I believe that Director's Flash components are happier if coded via member scripts. This being the case, there is no need to reference "me" in the handler's arguments because no object reference (I.E. "me") will be passed to the member script, and so trying to use it in your scripts could be causing the weird things to happen.

           

          That's all I can think of... that and "don't bother with the Flash components cos they haven't worked properly since Director 9!"

          1 person found this helpful
          • 2. Re: Baffling Flash component behavior
            bd525 Level 1

            Using member scripts didn't seem to help, and besides would take an enormous amount of recoding and restructuring. It looks like your final comment is the most pertinent. :-(

             

            Thanks for the input.

            • 3. Re: Baffling Flash component behavior
              Adam-C Level 2

              Are you re-using the same component member in multiple sprites (with different behaviours attached to these sprites)? If so then this is likely to be the problem because when you create a sprite from a component member you aren't creating an instance of that component - the sprite IS the component. Therefore if you use the component member in more than one sprite then any behaviours attached to those sprites will affect every other sprite based on the component member.

               

              FYI, I use a huge amount of embedded Flash objects within my Director apps. Doing this gives one access to the "real" Flash components (I.E. the ones that are inside Flash), which in-turn provides gives Director a massive boost in flexibility - trees, drop-down lists, value lists (with icons)... all sorts of things. It would also solve your problem with Director's Flash components (although whether it would be worth the reprogramming I don't know!). Plus you can code many of your own functions into the Flash SWF that can then be accessed and used by Director.

               

              If you've haven't done much SWF embedding with Director it can take a while to develop techniques for interfacing between Director and your Flash sprites, but this is an area in which things have generally improved in Director 11+ (a few notable bugs aside!). For example, you can call (and receive response from) Flash functions simply by calling the function on the SWF sprite; I.E. if you have a SWF in sprite 1, and the SWF has a function called "myFunction", then Director can use this function simply by calling "sprite(1).myFunction()". The function may return a value, or it may draw a text field, or create a data tree, or play a video with interactive overlays...

               

              Communicating from the embedded SWF back to Director is a lot less slick, and you're effectively limited to sending one-way messages that then need to be handled by a behaviour on the Flash sprite, but it's workable nonetheless.

               

              Maybe I'm telling you stuff you already know, but if it's not something you've looked into before then you should give it a go cos it fills-in a lot of the gaps in Director's arsenal.