A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: click-and-drag, no errors at first, but not working...

  1. #1
    Senior Member
    Join Date
    Oct 2009
    Posts
    112

    [RESOLVED] click-and-drag, no errors at first, but not working...

    I have an array of knobs, they all have functions so that you can click-and-drag left-right or up-down to make them rotate back and forth.
    when i have one knob on its own the code works fine. but now that i've put them in an arrary i've confused myself with the code.

    theres no errors to start, but when i click on any of the knobs i get this error:
    Code:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    	at D3264NEW_Scene1_fla::MainTimeline/knobPRESS()

    someone said i should put this:currentKnob=e.target;in the knobPRESS function, but then I got an error in the compiler errors when i started it up...

    is there a different way to write this, or any other ideas? thanks
    Last edited by mattwatts15; 11-12-2009 at 03:51 PM. Reason: mark as resolved

  2. #2
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    the answer you had is correct, just needs to be cast as the same type you declared currentKnob as.

    currentKnob obviously has to have a value in order for the rest of your code to work on it so just add this line as the first line in knobPress:
    PHP Code:
    currentKnob=e.currentTarget as MovieClip 

  3. #3
    Senior Member
    Join Date
    Oct 2009
    Posts
    112

    Resolved

    thanks!

Tags for this Thread

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center