×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    22

    Exclamation Problem with changing frame when object collides an object..

    Im making a small flash lite application.. it will be a game actually..
    So, theres 2 parts, one part that spins while its pressed down and another part wich checks if the spinning part touches the part. When i spin the object and it touches the square, it prints to output that they collide, but after the print thing i have gotoAndStop(45); wich doesnt run? the text shows up but it wont change frame?

  2. #2
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    Finland
    Posts
    134

    Re: Problem with changing frame when object collides an object..

    Looks like a general Flash issue, which are better answered by Adobe:
    http://forums.adobe.com/community/fl...h_actionscript

  3. #3
    Nokia Developer Champion
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Re: Problem with changing frame when object collides an object..

    Hi Mikusu,
    Try this :
    Code:
     _root.gotoAndStop(45);
    Best Regards,
    SajiSoft

  4. #4
    Registered User
    Join Date
    Oct 2010
    Posts
    22

    Re: Problem with changing frame when object collides an object..

    Still it doesn't work.

  5. #5
    Nokia Developer Champion
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Re: Problem with changing frame when object collides an object..

    Hi Miksu174,
    Actually, this issue is all because of coding. I think to fix this issue one have to take a look at your code.So, you can place the buggy part of your app or create a new app having this issue only. Mostly, it is good to try simple things firsts and see whether it is changing frame or not. For example :
    Code:
    if (spin.hitTest(square) ) 
    {
    gotoAndStop(45);
    }
    One more advice make sure your code is placed on the root frame instead of an object frame.

    Best Regards.
    SajiSoft

  6. #6
    Registered User
    Join Date
    Apr 2008
    Location
    India / Singapore
    Posts
    549

    Re: Problem with changing frame when object collides an object..

    Yes, as Sajid says, we need more clarity on your situation and your implementation..
    Thanks
    Twitter - manikantan_k
    Just in --

  7. #7
    Registered User
    Join Date
    Oct 2010
    Posts
    22

    Re: Problem with changing frame when object collides an object..

    Heres the code thats in the spinning part:

    on (press) {
    pressed=true;
    }
    on (release) {
    pressed=false;
    }


    onClipEvent(enterFrame){
    if(pressed==true){
    _root.Lever._rotation += 2;

    if(_root.Lever.hitTest(_root.hit)){
    gotoAndStop(46);
    trace( "Frame changed" );
    }

    }
    }

    When i run it and press the Lever it starts spinning, and when it hits a block called "hit" it should change the frame and print "Frame changed" to output, but when the lever touches hit, it just prints "frame changed" but doesnt change frame.

  8. #8
    Nokia Developer Champion
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Re: Problem with changing frame when object collides an object..

    Hi miksu174,
    As expected, I am sure that frame 47 lies on root ?? if yes try one of the following approach :
    1- Change gotoAndStop statement like this :
    Code:
    _root["gotoAndStop"](46);
    2- Labeled the frame 46 (lets say its name is "Jump" ) then change the gotoAndStop line like this :
    Code:
    _root.gotoAndStop("Jump");
    3- [AS 2 Approach] Instead of putting the event on the spinning part, put the code on the keyframe containing the spinning part like this (Lets say the instance name of your spinning part is "spin":
    Code:
    spin.onPress = function()
    {
    pressed=true;
    }
    spin.on.Release = function()
    {
    pressed=false;
    }
    spin.onEnterFrame = function()
    {
    if(pressed==true){
    _root.Lever._rotation += 2;
    if(_root.Lever.hitTest(_root.hit)){ 
    gotoAndStop(46);
    trace( "Frame changed" ); 
    }
    }
    One of the above solution have to solve your issue if frame 46 lies on the root. If not please let us know.

    Best Regards,
    SajiSoft

  9. #9
    Registered User
    Join Date
    Oct 2010
    Posts
    22

    Re: Problem with changing frame when object collides an object..

    Thanks! I replaced gotoAndStop(46); with _root["gotoAndStop"](46); and everything is working fine!

Similar Threads

  1. Phone won't send object on OBEX object exchange example...
    By dcg_sorenson in forum Bluetooth Technology
    Replies: 2
    Last Post: 2009-04-30, 16:55
  2. S60-Native-Object To Javascript-Object Binding ?
    By janakiram_g in forum Symbian
    Replies: 4
    Last Post: 2008-10-31, 22:21
  3. Replies: 9
    Last Post: 2007-03-21, 07:57
  4. How to put decoded video frame into a CFbsbitmap object?
    By ricksucn in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2007-02-15, 17:36
  5. More then one C-Frame Object in a application
    By Freddi in forum PersonalJava
    Replies: 0
    Last Post: 2003-03-25, 23:57

Posting Permissions

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