6 Replies Latest reply on Oct 5, 2006 6:16 AM by aniebel

    I need some help! =)

    Sketchsta Level 1
      Hey guys, i just wanna ask if anyone can help me with the action script coding to target the playhead in a different symbol.

      eg... i'm making a movieclip symbol to act as a button, with rollover, And rollout actions applied to it in it's own time frame. And a on(Release) action on the movieclip it's self.... i don't know if that makes sense =)....
      uum... i made a rectangle, made it a movieclip symbol, and applied a on(release) action to it... (i know u can't have mouse actions to a movie, so i changed the TYPE in the Properties pannel to Button....so then i can add mouse actions to it.) and INSIDE this symbol, i made the animation for the button....rollover, and rollout....

      the problem is, when i add the on(release) action to the symbol, all the inside actions (rollover, rollout) don't work.... and i have been trying to figure out how to add the on(release) action inside the symbol, but for it to control the timeline that the symbol is in...

      I'm explaining as best I can.... but if anyone doesn't understand, please ask me to explain again... cuz i REALLLLLY need help with this....

      Thanx in advance..
        • 1. Re: I need some help! =)
          Level 7
          You can use mouse events with movie clips just fine. I'd suggest looking at
          the MovieClip class in Help. Specifically, the entries beginning with 'on'.

          >>but for it to control the timeline that the symbol is in...

          Try: this._parent.gotoAndPlay("someFrame");

          Though I don't think buttons work like that. I rarely use them as MovieClips
          are much more powerful... But I think you just put an on(release) function
          on the button itself and then 'this' will reference whatever clip the button
          is placed in, it will not reference the button. If you're using a button,
          then rollovers are automatic, you only need the release function.



          --
          Dave -
          Adobe Community Expert
          www.blurredistinction.com
          http://www.adobe.com/communities/experts/


          • 2. Re: I need some help! =)
            Sketchsta Level 1
            thanx DMennenoh, I havent tried the _parent action yet. i mainly use movieclip symbols because like you said, they're more powerfull... but when i make a symbol and set it's type to movie clip, flash wount allow me to put mouse actions to it, thats why i make it a movie clip, but then change it to button in the properties pannel.

            i have been told to try _root command, but from what i can tell, _root reffers to the very first time line in the .SFA i'll try that one too i guess..

            i'm new to scripting, i need all the practice i can get. i've seen peoples SFA with next to nothing drawn in, but when export it as SWF, ALL these pics come in from no-where, which makes it look good, and a file size of like 3kb... IM SOOO JEALOUS!!!! i wanna learn that =)

            anyway, thanx for your help!! =)
            • 3. Re: I need some help! =)
              aniebel Level 2
              If you have a movieclip like your rectangle and apply an on(release) to it, Flash treats it as a button. Try this and see if it works for you. Make sure you give your rectangle an instance name. I'm going to use "rect_mc" as an example.

              on the timeline of your rectangle mc:
              Make 3 keyframes in a layer titled "labels" and label them as "_up", "_over", "_down". In the "_over" segment is where you put your animation. This sets up the movieclip with the same properties as a button.

              on your main timeline:
              rect_mc.onRelease = function(){
              dothisthang;
              };


              • 4. Re: I need some help! =)
                Sketchsta Level 1
                hey aniebel, i know what you mean, that would work just like a button symbol, like you said, but in my case that im workin on, i NEED the actual button to be just 1 frame... this is what i'm tryin to do:
                slide show....

                on(release)
                { if (this._currentframe == 31) {gotoAndStop(this._totalframes) }
                else {prevFrame}

                thats for the back button....

                so basically, the slide pictures start at frame 31, and i want it to loop when the playhead reaches the final frame in that particular timeline....
                but if i do it the way you suggested, the playhead will listen to the button codes, instead of the frames for the pictures...
                and if i make just a normal button symbol, i cant add a rollover animation.. =(

                P.S, if im doing something wrong in my scripting, please tell me...or if you have suggestions on how to make it work better. I'm realy new to ActionScript, but i wanna learn... =)
                • 5. Re: I need some help! =)
                  Sketchsta Level 1
                  ooops!!! i meant i can't add a rollOut animation.... =)

                  P.S...i like that " dothisthang" bit... =P
                  • 6. Re: I need some help! =)
                    aniebel Level 2
                    You can use the code the same way as the onRelease. Check it out...

                    rect_mc.onRollOut = function () {
                    this.gotoAndPlay("rollout");
                    }

                    You can create another keyframe labeled "rollout" which contains another animation or anything you like. I'm showing you how to code this from the main timeline because it's easier to make changes (mostly if you have more than one) and is more robust than applying the code inside the movieclip or button itself.