A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: knowing the value of a frame label

Hybrid View

  1. #1
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389

    knowing the value of a frame label

    Good morning,

    I've posted this as well in the games forum but I just tried something I wonder if it could work. My question was about knowing the value of a frame label representing a card from a deck movie clip containing all the cards as nested movie clips inside it.

    Each of the cards shows by going to the specified frame in the deck clip, but I now need to pass the value of the card to a server and don't really have an idea of how to do it.

    I've placed the code for the card's values inside the deck's clip's frames and I'm trying to pass it to the main timeline but I can't trace it since the client representing the first player is not the one in Flash's preview.

    My question is probabaly confusing, excuse me. I need to find a way to pass this value representing the card and I thought there could be a way to know which frame the clip has stopped at when clicking on it.

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi Cap,

    try using something like
    PHP Code:
    if(_currentframe == ???)

    // code to send vars;
    }

    //or
    var whichCard _currentframe;
    trace(_currentframe);
    //sendvarscode = myCard[whichCard]; 
    etc etc, not sure if that helps you in any way.

  3. #3
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389
    Hi, FruitBeard,

    thanks for the help. I saw in some other post an associative array would be needed to get the frame labels' name instead of the number so I decided to change the linkage names for the card movies and I got it working, even though every player is getting the same cards now, but I guess I will be able to solve that during the day sometime, I'm just too exhausted at this time of night. I believe I will be able to send the card's name and position in a much easier way, but I still don't remember how to attach movies or something because I'm getting this movie of the card in a corner of my swf. Why did this happen?

    here's some code:

    Code:
    for (i=0; i<aSuits.length; i++) {
    		playerHand[0][0].sortOn(["sCardSuit", "sCardNumber"], [Array.NUMERIC, Array.NUMERIC]);
    		for (j=0; j<aValues.length; j++) {
    			this.attachMovie(aSuits[playerHand[0][0][j].sCardSuit]+aValues[playerHand[0][0][j].sCardNumber], "card"+j, this.getNextHighestDepth());
    			this["card"+j]._x = 75+(35 * j);
    			this["card"+j]._y = 350;
    			this["card"+j]._xscale = 35;
    			this["card"+j]._yscale = 35;
    	}
    }
    and I erased the deck clip from the library, so there's nothing else on the stage.

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi Cap,

    From looking at the image you attached, I think you are using central alignment in the card movieclips, if you double each x/y value it should align it better, or alternatively, try using top left alignment with movie clip.

    But that's just a guess from the image

  5. #5
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389
    Good morning, FruitBeard,

    by central alignment do you mean the registration point of the clip?

  6. #6
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389
    Don't worry, FruitBeard, I solved it. Changed this.getNextHighestDepth() to j and it works now, even the card sorting is correct.

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