A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [RESOLVED] code confused...

  1. #1
    Senior Member
    Join Date
    May 2006
    Posts
    119

    [RESOLVED] code confused...

    can anyone explain to me why this code returns no matter where I drop the object (not just "DropZone")

    on (release) {
    stopDrag();
    if (tile_i._droptarget == tile_1.DropZone)
    trace("test");
    }

    Thanks

  2. #2
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Is this piece of code placed on the tile_i?

  3. #3
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    _droptarget property always returns a path that starts with a slash (/). So use the eval function to convert the returned value from slash syntax to a dot syntax reference.

    Code:
    // code placed as <movie clip action> on tile_i -
    
    on(press){ startDrag(this,true);}
    
    on (release) {
    stopDrag();
    if (eval(this._droptarget) == _root.tile_1.Dropzone)
    trace("test");
    }

  4. #4
    Senior Member
    Join Date
    May 2006
    Posts
    119
    nope, it still doesnt work right..... it returns no mater what....

    this is what Im using
    on (press) {
    startDrag(tile_i);
    tileSound = new Sound();
    tileSound.attachSound("I");
    tile = tileSound.attachSound("I");
    soundSeq.push("tile");
    }
    on (release) {
    stopDrag();
    if (eval(this._droptarget) == _root.tile_i.DropZone)
    trace("test");

    //if (tile_i._droptarget == "DropZone"){
    //trace("test");
    }

    BUT,
    when I try to trace a droptarget from a different file, it works fine!?
    this is the other code.

    on (release) {
    stopDrag();
    if (this._droptarget == "/hat") {
    trace("test");
    _root.hat.gotoAndPlay(2);
    }
    }

    the same does not work for the first case...
    I can not do relative pathing for the first .fla for some reason, when I do it, it drags EVEYTHING on the stage as if it were a single symbol..
    this is really confusing me.... sorry if Im confusing you guys with this explanation.

    oh and all these scripts are written on the button instances themselves.

    here is the .fla
    Attached Files Attached Files

  5. #5
    Senior Member
    Join Date
    May 2006
    Posts
    119
    Never mind my last rant!
    I guess the object has to be a MC, cant be a BTN, for the path to work!

    (I learnt something new!!)

    Cheers!

  6. #6
    Senior Member
    Join Date
    May 2006
    Posts
    119
    AHHHHH!!! now it wont push the variable!!!
    im more confused than ever......................
    HELP!!!!!

  7. #7
    Senior Member
    Join Date
    May 2006
    Posts
    119
    on (press) {
    startDrag(this);
    tileSound = new Sound();
    tileSound.attachSound("I");
    tile = tileSound.attachSound("I");
    soundSeq.push("tile");
    }

    on (release) {
    stopDrag();
    if (this._droptarget == "/DropZone"){
    trace("test");

    }
    }

    why wont this preform both the "trace" and the "push" of the variable on press?
    ?????????????????????????????????????????????????? ??????????????????????????

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