A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Comparation of movie clip?

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    6

    Exclamation Comparation of movie clip?

    Have 100 movie clips, each with an already defined value.
    Than 2 random cards from the display 100
    compare two movie clips

    I have 100 movie clip exemple:
    movieclip1.value = 96
    movieclip2.value = 2
    movieclip3.value = 8
    //
    movieclip1
    movieclip2
    movieclip3
    movieclip4
    movieclip5.... // 100 movieClip
    2 cards that show in adobe flash and being compared to each other, but randomly from the 100 cards.
    select ramdon:
    (movieclip5 > movieclip100)
    if(cardn.value > cardn.value)


    3) Might you explain me this line of code, I do not understand that it works for "new"
    Example:
    var myBirthdayate = new Date()

  2. #2
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    You have to explain better the first cards/movieclips thing.

    The last thing, "new" means creating a new instance of an object, in this case , a new instance of the Date object class. So it will get the current Date/Time(hour, seconds, minutes) from the user's computer clock.
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

  3. #3
    Junior Member
    Join Date
    Mar 2014
    Posts
    6
    I 100 (are poker cards so if you want to see) movie clips, each with a value already defined example:
    movieclip1.value = 1
    movieclip2.value = 3
    movieclip3.value = 6
    movieclip4.value = 8
    movieclip5.value = 10
    movieclip6.value = 19 / / ... to 100 movieclip
    Ok ... What I do is:
    Show 2 moviesclipN working in the area of flash, it Ramdon, of the 100 letters
    select 2 and compare:

    eg
    card1.value = 1;
    card2.value = 3;
    card3.value = 5; / movieclip to 100.

    if (car1.value> car2.value)
    {
    res.text = "card 1 is the big";
    }
    else
    {
    res.text = "card 2 is the Big";
    }

    1) I want to show two carts (Movieclip) random flash, who are among the 100 cards, already defined. but not repeated.
    how do I do this?

    2) And then you compare their values:

    if (carNRandon.value> CardNRandon.Value)
    {
    res.text = "The card is the Big";
    }
    else
    {
    res.text = "The card is The Big";
    }

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

    If you make a new AS3 document, paste this code then test it.
    PHP Code:
    var clipArray:Array = new Array();

    for (var 
    i:int 0100i++)
    {
        var 
    movieClip:Object = {name:"Clip : " Number(1), value:Number(1)};
        
    clipArray.push(movieClip);
    }

    function 
    getTwo(arr:Array,k:int):void
    {
        var 
    randNum:int;
        var 
    theTempTwo:Array = arr.concat();
        var 
    theTwo:Array = new Array();

        for (var 
    j:int 0kj++)
        {
            if (
    theTempTwo.length == 0)
            {
                break;
            }
            
    randNum Math.floor(theTempTwo.length Math.random());
            
    theTwo.push(theTempTwo.splice(randNum,1)[0]);
            
    theTwo.sortOn(['value'], [Array.DESCENDING | Array.NUMERIC]);
        }
        for (var 
    s:int 0theTwo.lengths++)
        {
            
    trace(theTwo[s].name " - value: " theTwo[s].value);
        }
        
    trace(theTwo[0].name " - value: " theTwo[0].value " is the higher of the two");
    }

    getTwo(clipArray,2); 


    I'm sure you can make it work with your very unclear problem, next time maybe post your *.fla file so (WE) can mess around with it

  5. #5
    Junior Member
    Join Date
    Mar 2014
    Posts
    6
    Wow!! nice... thnks men!! i go practicate with u code

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