A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] Help with X and Y Co-ords

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

    [F8] Help with X and Y Co-ords

    Hi, I'm desperately close to finishing this project, just one problem stands in my way.

    I create clips on the fly that are draggable, i want flash to be able to record their new X and Y positions when they are drooped and pass them onto a File.

    However in order to put the drag script onto the clips i've created a symbol within a symbol, so effectively
    [shirt]
    [shirtcontents] - with drag code-
    [/shirt]

    problem is the drag is setting the x and y co-ords relative to shirtcontents and not shirt (which being a symbol within a symbol is not relative to the stage).

    Basically I need a way to add the on(press) { startDrag(); } to shirt via actionscript when i call attachMovie(shirt), or a way to set the x and y position of Shirt through shirtcontents by going up a symbol, so instead of;

    this._x = _root._mousex; [this being shirtcontents within shirt, thus its x position is relative to the stage within the container shirt)

    i'm setting

    _root.shirt._x = _root._mousex


    lol its doing my head in please help

  2. #2
    Senior Member
    Join Date
    Jul 2005
    Posts
    165
    how about assigning shirtcontents the following script:
    Code:
    this.onPress = function() {
    this._parent.startDrag();
    } 
    this.onRelease = function() {
     stopDrag();
    }
    this way you press / release the inside, but drag the outside.

  3. #3
    Junior Member
    Join Date
    Feb 2006
    Posts
    19
    Thats -exactly- what i needed, wasn't sure how to call the container clip from the contained one, _parent worked a treat.

    Thank you sooo much!

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