STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
228068
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2560 · P5120

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/19112408?noj=FRM19112408-28DN" width="1" height="1"></div>

This is the wiki page for Flash #183177
Visit the flash's index page for basic data and a list of seen names.


random text tut.swf
37,4 KiB, 00:00 | [W] [I]

Threads (1):

[EYYW2E1]F http://boards.4chan.org/f/thread/2998288/for-the-macrom…
ARCHIVEDDiscovered: 13/1 -2016 22:48:58 Ended: 13/1 -2016 22:48:58Flashes: 1 Posts: 2
File: random text tut.swf-(37 KB, 550x400, Other)
[_] for the Macromedia 8 anon Anon 2998288 (part 1) So you want random text.I venture this would be the simplest way: * You want the random text when you start the movie, so we'll do this in a blank keyframe in the very first frame of the scene. When AS flow of control enters the first frame, it will set up the stage, and then execute any script we write in that frame. * You need a text output. Use the text tool to make a label somewhere on your stage in the first frame, and give it an instance name in the properties panel (like... myLabel). Now you can call it in code and assign it text. *You need some strings to populate your label. declare an array and give it some strings you want to have appear in your label: //sample code: var myStrings:Array = new Array("this is a random message.", "this is some other thing.", "you grandmother sucks eggs"); * Now we need to pick one of the strings at random and pass it to the label we made. A quick function to generate a random number of a desired rage: //sample code: function getRandomText(limit:Number):Number { var randomNumber:Number = Math.floor(Math.random()*(limit+1)); return randomNumber; } It returns a random number from 0 to -limit-. You give it the array element number of your last text (limit), in our case this will be 2. (continued...)
>> [_] Anon 2998293 (part 2) * You now have 3 strings in an array, and we can easily get a random number and generate the name of one of them to stick in the label. We can now simply assign one of the strings at random to the label's text field like so: //sample code: myLabel.text = myStrings[getRandomText(2)]; Finally, unless you want the timeline to keep running (or looping back and re-running the first frame if your flash is only one frame, or even very short), stop it after executing the script we wrote, like so: //sample code: stop(); *** *** to keep going now, you can use gotoAndPlay(frame); where frame is the number of the fram you want to start the playhead at. Also, gotoAndPlay(frame, "scene"); where scene is the name of a scene in the movie, and frame is a frame in that scene. *** *** That's it. 5 lines of code, 6 if you stop at the end. :^) The flash here is exactly this code, but there's a few more messages, and I've added a click handler (BEFORE the stop(); command!) so that every time you click the flash, it re-populates the label: //sample code: stage.addEventListener(MouseEvent.CLICK, repopulateLabel); function repopulateLabel(event:MouseEvent):void { myLabel.text = myStrings[getRandomText(2)]; } Now it's 8 whole lines, and you got half a Meet 'n' Fuck game built. All you need now is nice cartoon tits and a plot that doesn't suck. Have fun.



http://swfchan.net/37/183177.shtml
Created: 13/1 -2016 22:53:00 Last modified: 6/8 -2019 22:34:30 Server time: 28/04 -2024 10:05:10