A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Problem positioning an attachedMovie

  1. #1
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167

    Problem positioning an attachedMovie

    Hey everyone,

    Ok so I have this orangeBall that I would like to attach onto the main movie. Now the problem is not that I dont know how to do it rather that Im going to need more then one orange ball.

    These orange balls when placed on the screen (middle/right) will move across the screen and the unload themselves. I can do that just fine and have done it in the past.

    The problem lies however in getting the orange ball to appear multiple times because it requires concatentation (sp?) and I dont think Im doing it right haha.




    Anyways, heres what the code looks like:

    code:

    onLoad = function () {
    orangeBalls = 1;
    };
    //
    onEnterFrame = function () {
    seconds = Math.floor(getTimer()/1000);
    if (seconds/5 == 1) {
    _root.attachMovie("orange", "orange"+[orangeBalls], 0);
    _root.orange[orangeBalls]._x = 620;
    _root.orange[orangeBalls]._y = 292;
    }
    };



    So when the movie loads, it sets orangeBalls to 1 which is used in concating the attached Movieclips. I then set a timer that checks the seconds.

    Following that is an IF statment that checks if and when 5 seconds goes by and if so then it attempts to attach a movie.

    It then sets the coordinates of the movie to 620 and 292. The problem is that its not attaching, its that its not putting them at those coordinates. Instead it sticks it at the upper left corner.

    If anyone could please give me a hand I would be greatful

  2. #2
    Member
    Join Date
    Oct 2005
    Posts
    82
    Hi Osteel,
    I don't know much about Flash, in fact you've helped me alot.
    I've had that problem with MCs, have you tried playing with the coordinates
    to see if you can adjust that way. Sometimes I plan on having something load and
    just have to rely on sight rather than the program itself.
    I don't know if this helps, but I figured I'd give you my thoughts.
    VN
    Nuttin' like fresh powder for a vertical fool.

  3. #3
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    Haha thanks,

    Well I've managed to do what I want successfully only with ONE attach movie when the movie loads. I then had to move onto the next step of attaching the movie using concatation (orange[orangeBalls]) since I will be using more the one orange ball at once.

    But even still, I dont know why its not moving to the right coordinates ... it boggles my mind

  4. #4
    Farmer divillysausages's Avatar
    Join Date
    Mar 2004
    Location
    ireland
    Posts
    251
    Code:
    onEnterFrame = function () {
    
    	seconds = Math.floor(getTimer()/1000);
    
    	if (seconds/5 == 1) {
    
    		_root.attachMovie("orange", "orange"+orangeBalls, 0);
    
    
    		_root["orange"+orangeBalls]._x = 620;
    
    		_root["orange"+orangeBalls]._y = 292;
    
    	}
    
    };
    should work. although you'll need to ++ orangeBalls to get any more in, as well as changing the depth;

  5. #5
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    Hey Divilly,

    I appreciate the help, it worked just fine

    Many thanks

    [Edit: Quick question though, is it nessessary to place each attached object on a seperate depth?]
    Last edited by Osteel; 01-11-2006 at 11:14 AM.

  6. #6
    Farmer divillysausages's Avatar
    Join Date
    Mar 2004
    Location
    ireland
    Posts
    251
    yeah, cause if you attach another ball at the same depth of a current ball, then it will remove the current ball. that's what's happening at the minute, only you can't see it cause the new ball is getting the same x and y as the old one. only one object can be on a depth at one time. just use orangeBalls as the depth as well
    Code:
    _root.attachMovie("orange", "orange"+orangeBalls, orangeBalls);
    //incret up so we can add more
    orangeBalls++;

  7. #7
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    Ah that would make sense.

    Dont you just love how you get these ideas of something you want to make, thinking you know everything there is to make it. Then you run into walls

    Gotta love places like Flashkit.

    Thanks for the help

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