10 Replies Latest reply on Jan 12, 2008 3:40 PM by clbeech

    Custom Cursors- drawing bitmaps?

    mikeumus Level 1
      Hello everyone,
      I went on to www.youtube.com and found a tutorial to set up custom cursor using the actionscript(2.0) on the actualt movie clip(which was my cursor):

      onClipEvent(enterFrame)
      {
      _x=_root._xmouse
      _y=_root._ymouse
      }

      And the actionscript on the acutal frame:

      Mouse.hide()

      This code sufficiantly replaced my mouse with my movie clip, but I noticed when i moused over my button, they did not show the same mouse over that I had with the normal mouse.

      Another thing I could like to acomplish is, when my custom cursor click anywhere in the flash movie, it overlays a bitmap(an image(a .jpeg)) on that instance of that flash movie. I've seen it done before in flash sites that allow that user to create things such as characters or art. I know it's posible, but I've searched all of the internet and have gained no fruit from it.

      If anyone would be so kind as to show me how to go this, or even simply point me to a link. I would be very greatful. If I do get it working, I'll be sure to share it with the community, as what I'm gonna use it for is pretty cool in my opinion.
      Thanks for your time and consideration.

      Peace,
      Mike.
        • 1. Re: Custom Cursors- drawing bitmaps?
          clbeech Level 3
          1) do you mean that the 'hand cursor' did not show up when you rollOver a button instance? There is a command to show or hide this as well.

          2) do you mean that you would like to add an image Bitmap when you click on the Stage? or are you trying to use the drawing API?

          to add an image when the user clicks the mouse, you will need to have an image converted to a MC in the Library with a 'Linkage Idnetifier' name (right click the symbol in the Library), then you you will need to use a Listener Object and the onMouseDown event handler. when the event is triggered, you will then use the 'attachMovie()' method to place an instance of the MC on the Stage, and pass an Init Object in the call to place the MC at the current Mouse coordinates. With the symbol in the Library (let's say the id name is 'myImage') the code will look something like this, and will be placed on the main timeline in the first frame, 'actions' layer:

          • 2. Custom Cursors- drawing bitmaps?
            mikeumus Level 1
            Thanks so much for helping with the createMovieClip() code!!!! Oh man!

            Addressing the first question
            quote:

            1) do you mean that the 'hand cursor' did not show up when you rollOver a button instance? There is a command to show or hide this as well.
            I've replaced the mouse with my movieClip, which is good, but when it rolls over buttons. The over state shows a glimpse of what should be showing when the mouse has engaged the over state of the button, but doesn't. It's werid. When I drag the mouse over the button with a consistant rate of momement, the over state kind of works. AHH!! Please help!
            • 3. Re: Custom Cursors- drawing bitmaps?
              clbeech Level 3
              do you have some sort of animation on the Over state, and is this a true 'button' symbol instance?

              what is the code that you are calling to fire the Over state if this is not a button, or do you have any other codes related to the instances Over state?
              • 4. Re: Custom Cursors- drawing bitmaps?
                mikeumus Level 1
                I used a normal button, like from the component menu. It has a the over down and hit (i forget the first state) states just like a normal button. I got a ket frame on the over state and have it playing movieclips when on the over state, but this is not working with my custom cursor.

                8(
                • 5. Re: Custom Cursors- drawing bitmaps?
                  clbeech Level 3
                  I'm not sure why this wouldn't be working for you. I've created a very simple example for you to examine. Check to see if there is anything within the MC animations that may be causing this. Is there any code in the MCs?

                  FLA FILE
                  • 6. Re: Custom Cursors- drawing bitmaps?
                    mikeumus Level 1
                    Thanks for your help man. I almost got the site done.
                    • 7. Re: Custom Cursors- drawing bitmaps?
                      clbeech Level 3
                      you're welcome, and good for you :)
                      • 8. Re: Custom Cursors- drawing bitmaps?
                        mikeumus Level 1
                        So I put the code clbeech seggusted in the actions frame and it didn't work.



                        How do I insert a link to download my flash file so that someone can see waht's actually going on?

                        Also,

                        I'm having trouble with button events.
                        I entered some code in the actions palette after clicking on the button in the stage. The code was:

                        on (release) {

                        gotoAndPlay(36);
                        }

                        Simple enough right?
                        Well the frames didn't play, it glitched for a second, teasing me as if it would, but didn't.
                        I got this compilke error:
                        Mouse events are premitted only for button instances.

                        This was the error I got from clbeech's code after inserting it on the first frame in the actions layer.

                        Expected a feild name '.' operator.
                        • 9. Re: Custom Cursors- drawing bitmaps?
                          mikeumus Level 1
                          I fixed the errors.

                          But still can't get the images to apear after i click on the stage.

                          • 10. Re: Custom Cursors- drawing bitmaps?
                            clbeech Level 3
                            hey mike, the first error would indicate that you'd place the on(release) code on the main timeline, and although that is where you really should put all your code, this syntax is meant to be attached to a button or MC instance's code window. that would be when you select an instance, THEN open the actionscript window and apply the code there.

                            the second is harder to be sure, you may have missed something in changing the code to fit your instance names.

                            to post a link to the file, zip the file, upload it to a directory on your server, then post a link here to the address.