Jump to content


How get random letter with Flash mx?


  • You cannot reply to this topic
9 replies to this topic

#1 napalias

    Young Padawan

  • Members
  • Pip
  • 5 posts
  • Gender:Male

Posted 14 March 2007 - 03:55 PM

How get random letter with Flash mx? I want create movie symbol with this letter.

#2 Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 15 March 2007 - 03:39 PM

Well, you could make a blank dynamic textbox, and call it's instance "randTxt". Then, in the first frame:
function randomise() {
		var charStr:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		randTxt.text = charStr.charAt(random(charAt.length-1)+1);
}
Then execute the function whenever...
randomise();


#3 neutron

    Young Padawan

  • Members
  • Pip
  • 12 posts
  • Gender:Male
  • Interests:flash, photography, travel, games

Posted 16 March 2007 - 03:20 AM

Idea is ok, but will not work in MX, since this is as2 code.

#4 napalias

    Young Padawan

  • Members
  • Pip
  • 5 posts
  • Gender:Male

Posted 16 March 2007 - 03:55 AM

need static not dynamic text beacause want in motion tween change alpha color.

#5 Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 16 March 2007 - 07:54 AM

AS1 code:
function randomise() {
		var charStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	   trace(charStr.charAt((Math.random()*charStr.length-1)+1));
}
randomise();

Flash MX (or Flash 6) was the first version of Flash to have Actionscript 2. You cannot modify the text in static text during runtime. If you want to animate your dynamic text, put it inside a movieclip and animate that movieclip.

Edited by Pax, 16 March 2007 - 07:55 AM.


#6 napalias

    Young Padawan

  • Members
  • Pip
  • 5 posts
  • Gender:Male

Posted 16 March 2007 - 01:13 PM

i'm try but not wirking with change alfa, just movie from A to B bu not blur

#7 Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 16 March 2007 - 02:16 PM

Blur is a flash 8 thing. If youre using MX it wont work. Without seeing the .fla, it will be difficult to really see what you need.

#8 napalias

    Young Padawan

  • Members
  • Pip
  • 5 posts
  • Gender:Male

Posted 17 March 2007 - 06:46 AM

if text is static i'm change alfa color ant text disapear.

#9 Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 17 March 2007 - 09:08 AM

Put the dynamic text inside a movie clip and embed the font. Then your animations will work with dynamic text.

#10 napalias

    Young Padawan

  • Members
  • Pip
  • 5 posts
  • Gender:Male

Posted 19 March 2007 - 04:27 AM

Thanks

I'm found another way:

onClipEvent (load) {
shuffle = chr(random(26)+65);
}

and embend
:)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users