Welcome to TalkGraphics.com
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: moving problem

  1. #1
    Join Date
    Feb 2008
    Posts
    6

    Default moving problem

    Hi,

    I am trying to make 2 circles (MC) move with the LEFT arrow after I click on one of them (selecting witch to move)(ex.clic ball1 move it with the key, then click ball2 and move it..). But I can move only one circle, the other it doesn't respond when I click on it. Can you help me with this?
    ---------ball1
    on (press){ sel=1; } on (keyPress "<Left>"){ if(sel==1) this._x = this._x -5 }
    ---------ball2
    on (press){ sel=2; } on (keyPress "<Left>"){ if(sel==2) this._x = this._x -5 }
    ------------first frame
    sel=0
    Reply With Quote
    IP

  2. #2
    Join Date
    Nov 2000
    Location
    Red Boiling Springs TN USA
    Posts
    19,208

    Default Re: moving problem

    Xara flash animations do not support the same features that are available in Flash or SwishMAX.

    What you are wanting to do cannot be done in Xara Xtreme.

    NOTE: This thread was originally posted in the Xara Flash forum
    Last edited by Egg Bramhill; 11 February 2008 at 01:36 PM. Reason: Clarification
    Soquili
    a.k.a. Bill Taylor
    Bill is no longer with us. He died on 10 Dec 2012. We remember him always.
    My TG Album
    Last XaReg update
    IP

  3. #3
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,916

    Default Re: moving problem

    I'll move this thread to the Flash forum in a couple of days, but as Pops is a new member I'll leave it here at present.

    In frame1 put the following code:
    Code:
    var distance:Number = 2;
    this.createTextField("display_txt", 999, 0, 0, 100, 20);
    
    var keyListener:Object = new Object();
    keyListener.onKeyDown = function() {
        if (Key.isDown(Key.LEFT)) {
    		if (sel=="ball1") {
                    ball1_mc._x = Math.max(ball1_mc._x - distance, 0);
    		} else if (sel=="ball2") {
    		ball2_mc._x = Math.max(ball2_mc._x - distance, 0);
    		} else if (sel=="ball3") {
    		ball3_mc._x = Math.max(ball3_mc._x - distance, 0);
    		}
            display_txt.text = "Left";
        } else if (Key.isDown(Key.RIGHT)) {
                    if (sel=="ball1") {
                    ball1_mc._x = Math.max(ball1_mc._x + distance, 0);
    		} else if (sel=="ball2") {
    		ball2_mc._x = Math.max(ball2_mc._x + distance, 0);
    		} else if (sel=="ball3") {
    		ball3_mc._x = Math.max(ball3_mc._x + distance, 0);
    		}
            display_txt.text = "Right";
    	}
        
    }
    Key.addListener(keyListener);
    for each MC give them the following code and instance names:

    Code:
    on (press) {
    	_root.sel="ball3"
    }
    That will work fine. Test it below. Click on a ball and use the left right keys.

    Attached Files Attached Files
    Last edited by Egg Bramhill; 10 February 2008 at 03:47 PM.
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host
    IP

  4. #4
    Join Date
    Feb 2008
    Posts
    6

    Default Re: moving problem

    Thanks Egg Bramhill , from all the forums where I heve asked this question you are the only one who can give me a complet and working answer.Thanks again.
    IP

  5. #5
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,916

    Default Re: moving problem

    Yes I saw your post in ActionScript.org
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host
    IP

  6. #6
    Join Date
    Feb 2008
    Posts
    6

    Default Re: moving problem

    One last thing, if I want to make them move on click not on keyPress how should I modifiy the script?
    IP

  7. #7
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,916

    Default Re: moving problem

    Hi again, what's "on click" supposed to mean?
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host
    IP

  8. #8
    Join Date
    Feb 2008
    Posts
    6

    Default Re: moving problem

    Actually I have attached my game here so you can see it. The problem is that I want to be able to move both this balls after I select them. I have only managed to make one move, the top on, but I don' t manage to make both move, it's a listener thing, I really don't know how to implement that listener to select my MC here, maybe you can help with this.Thanks .
    Attached Files Attached Files
    Last edited by popescuradhoo; 11 February 2008 at 05:36 PM.
    IP

  9. #9
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,916

    Default Re: moving problem

    pop,

    You must be using Flash 9 as I can't open your file, I've only got Flash 8.

    Could you save it in Flash 8 and upload it again.

    Egg
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host
    IP

  10. #10
    Join Date
    Feb 2008
    Posts
    6

    Default Re: moving problem

    Ok I have attached my fla.(You can only move on the black squares,, I am trying to make a game like this http://pc.gamezone.com/gamesell/p17418.htm but I can't get the moving part right).
    Last edited by popescuradhoo; 12 February 2008 at 04:35 AM.
    IP

 

 

Bookmarks

Posting Permissions

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