Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

MovieCLip Comparation

Guest
Mar 20, 2014 Mar 20, 2014

Good night. A Hug from Venezuela!
I am entering the world of Flash and as3 and I have a question about the movie clip.
I have a movie clip and each has a value, my question is:
As I can make a comparison between them to see which is the greater and which is smaller?

example:
I have 10 cards and compare between them to see which is the highest and lowest
How can I do this?
thnks All !

TOPICS
ActionScript
587
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 20, 2014 Mar 20, 2014

Assign each movieclip's value as a property of that movieclip and then compare the values against each other.

if(movieclip1.value > movieclip2.value){

     trace("movieclip1 is highest")

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 20, 2014 Mar 20, 2014

thanks for replying.

Sorry but I still do not understand very well the technical mastery in English language I'm using the google translator

Might you give me an example, I fail to understand code better? Thanks and sorry to bother
"Assign each movieclip's value as a property of that movieclip"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 20, 2014 Mar 20, 2014

"Assign each movieclip's value as a property of that movieclip"

Movieclips are dynamic objects which means you can assign properties to them dynamically...

movieclip1.value = 1;

movieclip2.value = 2;

etc....

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 20, 2014 Mar 20, 2014

o thnks man!!! u are the best !!
my Simple Code:

cart1.value = 40;

cart2.value = 39;

if(cartblu.value > cardred.value)

{

     trace("The Card Blu is The best");

}

else

{

               trace("The card Red Is The Best");

}

I have 3 more questions, and I'm sorry to bother starting with as3, I've only programmed in c + + 6.0 and basic things no big deal and I can not understand the things I'm reading a book by as3

http://help.adobe.com/es_ES/ActionScript/3.0_ProgrammingAS3/flash_as3_programming.pdf

You can add 2 different values ​​to a movie clip?

example:

movieclip1.value = 1

movieclip1.value = 96

movieclip2.value = 2

movieclip2.value = 58

movieclip3.value = 1

movieclip3.value = 857

etc ...

1) What I mean is that each movie clip is 2 values​​, when making a call to the value of

clipdepelicula1.Value = 1 / / value of the card

and when you need to make an event that needs the second value of the same letter

clipdepelicula1.value = 96 / / Points that gives the letter

2) my other question is:

  I have 100 movie clips, each with a value already defined

as an achievement to make 2 clips of movies comparing random (that is Ramdon the comparison, ie that you can select 2 random movie clip and compare)

3) Might you explain me this line of code, I can not understand that it serves the function "new" if I Might to another example.

Thank you I thank you from the heart!

A Hug from Venezuela


var myBirthday:Date = New Date()
for the reserved word is used "new"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 21, 2014 Mar 21, 2014

1.  You cannot have the same variable name assigned and give it two values unless that variable is an array or some other data structure that allows for holding more than one value.  What you just showed would work if you used Value = 1 (uppercase V)  and value = 96 (lowercase v)

2. I do not see a question in what you write

3. The correct way to write that is to use "new" (lowercase n)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 21, 2014 Mar 21, 2014

2) my other question is:

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

movieclip2

movieclip3

movieclip4

movieclip5....

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"

var myBirthday:Date = new Date()

thanks for replying!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 21, 2014 Mar 21, 2014
LATEST

If you want to randomly select the movieclips then you can use the Math.random() function to pick the number and then use that for targeting the movieclip....

var mcNum1:int = 1 + Math.floor(Math.random()*100);

var mcNum2:int = 1 + Math.floor(Math.random()*100); // could redo if it equals mcNum1

// the following uses bracket notation to target objects via string versions of their instance names

if(this["movieclip"+String(mcNum1)].value > this["movieclip"+String(mcNum2)].value){

   .... etc...

3) Anytime you want to create a new instance of a class you do so using the "new" designation so that the compiler knows it is dealing with creating an instance and is not an assignment to represent some other already existing object

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines