A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: load button to certain x, y position???

  1. #1
    Junior Member
    Join Date
    May 2006
    Posts
    19

    load button to certain x, y position???

    hi guys,

    Code:
    stop();
    
    this.createEmptyMovieClip("flag1holder", this.getNextHighestDepth());
    flag1holder.createEmptyMovieClip("flag1container",this.getNextHighestDepth());
    flag1holder.flag1container.attachMovie("BUTTflag1");
    flag1container._x=10;
    flag1container._y=10;
    break;
    }
    yes this code doesn't work. i need to load a non-component button (BUTTflag1) and i want it to load at a defined position on the stage. i would prefer it didn't have to be loaded into movieclips, but if thats what it takes then ok cool.

    please please please help guys, i know this is probably elementary stuff.

    thanks in advance!

    James

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,
    Some corrections to your code:
    code:

    this.createEmptyMovieClip("flag1holder", this.getNextHighestDepth());
    flag1holder.createEmptyMovieClip("flag1container",flag1holder.getNextHighestDepth());
    flag1holder.flag1container.attachMovie("BUTTflag1", "new_name", flag1holder.flag1container.getNextHighestDepth());
    flag1holder.flag1container._x=10;
    flag1holder.flag1container._y=10;



    Attaching and positioning a movie clip (or button) is just:
    code:

    var temp_mc = this.attachMovie("my_mc","new_mc",this.getNextHigh estDepth());
    temp_mc._x = 100;
    temp_mc._y = 200;


  3. #3
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    try this method
    Code:
    ref1 = this.createEmptyMovieClip("r1", Depth++);
    ref2 = ref1.createEmptyMovieClip("r2",Depth++);
    init = {_x:100,_y:200};
    ref2.attachMovie("BUTTflag1","BUTTflag1",Depth++,init);
    
    /* this compiles as -
    Variable _level0.Depth = 3
    Variable _level0.ref1 = [movieclip:_level0.r1]
    Variable _level0.ref2 = [movieclip:_level0.r1.r2]
    Variable _level0.init = [object #1, class 'Object'] {
        _y:200,
        _x:100
      }
    Movie Clip: Target="_level0.r1"
    Movie Clip: Target="_level0.r1.r2"
    Movie Clip: Target="_level0.r1.r2.BUTTflag1"
    */

  4. #4
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    If you're publishing for Flash Player 7 or later, you need to initialize variables. In this case, Depth:
    code:

    var Depth = 0; // for example


    Using lowercase for variables is more usual:
    code:

    var depth = 0;


  5. #5
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    Hi Nunomira ..
    still with MX6 here,
    I will upgrade one day

  6. #6
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    Didn't mention it, but I saw that in your signature - so it was not exactly for you, but for anyone else that reads this post

    A good practice though, even if you're publishing for FP6!

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