dcsimg
A Flash Developer Resource Site

Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 41

Thread: TypeError: Error #1006: value is not a function.

  1. #21
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    And? What was the result?
    I don't see where you add the click listener to btn. I presume it's just like you did for backBtn.

  2. #22
    Junior Member
    Join Date
    May 2011
    Posts
    21
    The result was nothing. No trace even in output.

    Sorry the code I posted before was wrong for pmovie. The code i had was:

    Code:
    backBtn.addEventListener(MouseEvent.CLICK, back);
    
    function back(event:MouseEvent):void{
    	MovieClip(parent).gotoAndStop(1);
      dispatchEvent(new Event("BACK", true));
      
    }

  3. #23
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Do one or the other of those lines inside back, but not both. They are alternative methods.

    But you really need to figure out why back isn't getting called. To check, your trace statement is in back, right?
    Code:
    function back(event:MouseEvent):void{
      trace("in back function");
      dispatchEvent(new Event("BACK", true));
    }

  4. #24
    Junior Member
    Join Date
    May 2011
    Posts
    21
    I've managed to get the trace to display in the output tab but still no luck going back to the parent :/

  5. #25
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Put another trace in goBack and make sure that's getting called.

  6. #26
    Junior Member
    Join Date
    May 2011
    Posts
    21
    Code:
    addEventListener("BACK", goBack);
    
    function goBack(e:Event):void{
    	trace("goBack");
      gotoAndStop(1);
    }
    like so?
    Just retrieving the one trace from pmovie and not this new one.

  7. #27
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Yes, like that.

    If you're not getting that trace, then the button is not a display descendant of pulmonic, so your structure is not as you said it was. Or something even weirder is going on with frame crap.
    Do you add pmovie through code? Post that code.

  8. #28
    Junior Member
    Join Date
    May 2011
    Posts
    21
    Nope just dragged it on stage and named it as pmovie through properties panel.

  9. #29
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    The way event bubbling works is that when a display object dispatches a bubbling event, it and all its display ancestors get a chance to react to that event. The only way I can think of that would result in the trace from back happening and the trace from goBack NOT happening is if pulmonic is not a display ancestor of pmovie.

    When you said you drag pmovie on stage, you do mean that you made it a child of pulmonic, right?

  10. #30
    Junior Member
    Join Date
    May 2011
    Posts
    21
    Yeah sorry. I dragged pmovie onto the stage while in pulmonic.

    I closed the fla and opened it again and for some reason the back button in pmovie now displays both trace outputs from pulmonic and pmovie.

  11. #31
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Great! So it's working?

  12. #32
    Junior Member
    Join Date
    May 2011
    Posts
    21
    Well the trace is. Just not redirecting to pulmonic.

  13. #33
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I don't know what you mean by redirecting. pulmonic is going back to its frame 1, right? What else did you expect to happen?

  14. #34
    Junior Member
    Join Date
    May 2011
    Posts
    21
    Sorry, my wording isn't being helpful.

    I meant that it's not redirecting me to frame 1 of pulmonic.

    I start off in pulmonic, click a button to go into pmovie, then to get back out of pmovie the button to do this only displays trace outputs from pulmonic and pmovie and does not show the first frame of pulmonic.

  15. #35
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Sorry, I don't see how it could be that the gotoAndStop line is called but it doesn't go. About the only thing I can think of is that there's a different instance of pulmonic than the one you're looking at. But that seems unlikely. Seems more likely the flash ide is screwing up.
    Getting any error messages?

  16. #36
    Junior Member
    Join Date
    May 2011
    Posts
    21
    Code:
    btn.addEventListener(MouseEvent.CLICK, back);
    
    function back(event:MouseEvent):void{
     trace("BACK");
     dispatchEvent(new Event("BACK", true));
    }
    Could it be that I haven't made reference to the pulmonic instance within the pmovie code?
    Or is this what dispatchEvent should do?

  17. #37
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    dispatchEvent does not make a reference, but it does enable the communication. When pmovie dispatches the BACK event, that event "bubbles" up through all the display list ancestors in turn, and any of them can listen for it. Since you added the event listener in pulmonic, it hears that event. We know it hears the event because the trace you put in the event listener occurs.

  18. #38
    Junior Member
    Join Date
    May 2011
    Posts
    21
    Oh I see, is there a way i could remove the pmovie by pressing back so that it is no longer shown instead of redirecting to frame 1 of pulmonic?
    Would this be a better way of doing it?

  19. #39
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Sure, you can have pulmonic react to the event however you like.

  20. #40
    Junior Member
    Join Date
    May 2011
    Posts
    21
    Oh i wait. I've solved it somehow. Basically what I think I was doing might seem a little strange. I think that I was calling pmovie from the library but because I already had pmovie placed on the stage within pulmonic, it was showing both of these movieclips at the same time. When i clicked the back button it was referring me back to frame 1 of pulmonic but either the pmovie I called from the library was staying in place so I couldn't see this happening or the pmovie already in pulmonic was staying in place so I couldn't see this happening.

    Would that make sense?

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