Archive for Flash

Flash ActionScript 3.0 XML Text Array Loader

After creating the Flash 8 ActionScript 2.0 Image slideshow modifications, I wanted to start from scratch on my next set of tutorials with AS3. AS3 is very different from AS2, the learning curve is not easy but its worth it. I would like to recommend a few books to help you get started in AS3; Essential ActionScript 3.0 by Colin Moock and Learning ActionScript 3.0: A Beginners Guide by Rich Shupe and Zevan Rosser. This is my first tutorial in a series where I will be rebuilding the XML/Flash Slideshow in ActionScript 3.0.In this tutorial, I will be focusing on how to setup your XML file, how to read in text from that XML file into you flash, and how to move through the xml nodes in your flash file and have them show up.First thing is first, how do you setup your XML file, I used a lot of examples from Colin Moock's book to achieve this. By no way is my way the right way, since XML is pretty flexible. I setup my xml file by opening up with a parent node "images" then placing all of the attributes within each node "image". AS3 makes it really easy to pull the varibles out, so thats why I set it up this way. Here is a screenshot:AS3 Part 1 Tutorial - XML FileNext, I setup my AS3 file. I opened a new AS3 document, and created two movieclips and gave them instance names of prevBtn and nextBtn. I didnt setup my code in OOP, that will be part of the next tutorial. I just wanted to do something basic here to help people get started. I also added a dynamic text field to the stage and gave it an instance name of "imageText".

Step 1: Declare Your VariablesThis is where I setup my Loader and XMLList instances. I also setup slideNum which Im going to be using to hold the position or index of the array.

Actionscript:
  1. //variables
  2. var xmlList:XMLList;
  3. var mcLoader:Loader;
  4. var slideNum:Number = 0;

Step 2: Load the XMLNow I setup the loader request for XML and once its finished loading using the EventListener, then I tell flash to pull the name attribute out of the first node in my xml file and place it in the dynamic text field called imageText.

Actionscript:
  1. //loads xml and assigns the text field the first node using the slideNum variable from above
  2. var xml:XML = new XML();
  3. var loader:URLLoader = new URLLoader();
  4. loader.load(new URLRequest("images.xml"));
  5. loader.addEventListener(Event.COMPLETE,
  6. function(evt:Event):void {
  7.         xml = XML(evt.target.data);
  8.         xmlList = xml.children();
  9.         trace(xmlList);
  10.         imageText.text = xml.image[slideNum].@name.toString();
  11.     }
  12. );

Step 3: Add Event ListenersNow Im telling flash that whenever a user clicks to perform a function. So if a user clicks on nextBtn, the onClickNextSlide function will run. If a user clicks on prevBtn, the onClickPrevSlide function will run. This is one of the biggest changes of AS3, whenever you create a button, you must always assign it an event listener. There seems to be much more flexility in this way.

Actionscript:
  1. //stage event listeners for the movieClip buttons
  2. nextBtn.addEventListener(MouseEvent.CLICK, onClickNextSlide);
  3. prevBtn.addEventListener(MouseEvent.CLICK, onClickPrevSlide);

Step 4: Change Text FunctionThis function works with the buttons. The text will change based on the slideNum var that is fed into the function from the button functions which come next

Actionscript:
  1. //this function will change the text depending upon which number is fed to the var slideNum in the onClickNextSlide function
  2. function changeText(slideNum:Number):void {
  3. imageText.text = xml.image[slideNum].@name.toString();
  4. }
  5. changeText(0);

Step 5: Button FunctionsThe onClickNextSlide function increases the slideNum variable with each click. If slideNum reaches 4 (the total number of nodes), then it starts over at 0. The onClickPrevSlide function does the reverse.

Actionscript:
  1. //this function adds 1 to the current number, if the current number is 4, it starts over
  2. function onClickNextSlide(event:MouseEvent):void {      
  3.     slideNum++;  
  4.     trace(slideNum);       
  5.     if (slideNum == 4) {           
  6.         slideNum = 0;      
  7.     }      
  8.     changeText(slideNum);}
  9.     // this function dos the opposite of the one above, it subtracts 1 to current number, when it reaches 0 it starts back at 4
  10.     function onClickPrevSlide(event:MouseEvent):void {      
  11.         slideNum--;  
  12.         trace(slideNum);       
  13.         if (slideNum == 0) {           
  14.             slideNum = 4;      
  15.         }      
  16.         changeText(slideNum);}

There is currently some known issues which Im going to fix and re-release. I know currently that if you try to go backwards when the flash first loads, it wont work. The previous button only works after you go forward first. If anyone has a solution, please post a comment. Here is an example of the working file:View Demo

Comments (9)

ActionScript Basics: One

Data Types

* Strings or Literal Values ["ActionScript"]
* Numbers [5]
* Boolean [true] - these are useful for making decisions

Variables

A variable is a container that is used to store your data
variable = value;
How to Write Variables
Naming Variables: Important Tips to Remember

* Don't Use Reserved Names such as: {}, ;, (), break, call, case, continue, default,delete,do,else, function,for,if,in,new,on,return,set,switch,this,typeof,var,void,while, and with.
* Don't Use Spaces
* Don't Begin Variables with Numbers
* Don't User Operators in Variable Names
* Don't Use the period (.) operator in your variable names

Example Variable Names

* cow
* cowPuke
* menu6

Three Ways of Writing Variables

* nQuantity = 10;
* var nQuantity = 10;
* nQuantity:Number = 10;

var nQuantity:Number <-- how you declare the datatype and variable

nQuantity = 5; - an expression which says nQuantity is equal to 5.
Assignment Operators

* (addition)
* - (subtraction)
* = (assignment) [for assigning variables]
* == (equality) [test two expressions for equaltiy nQuantity == 10]
* / (division) [divides two expressions 10/20]
* * (multiplication) [multiples two expressions 10 * 20]
* (increment) [add 1 to an expression, nQuantity ]
* -- (decrement) [subtract 1 from an expression, nQuantity--]
* < (less than) [compares two expressions]
* > (greater than) [compares two expressions]
* != (inequality) [test for inequality of two expressions - nQuantity != 10;]
* = (addition assignment) [example experession1 = is the value of expression1 expression2, shorter way to write this out]
* -= (subtraction assignment) [examples expression1-= is really saying subtract expression 1 from expression 2]

Expressions

Expressions are often sequences of literals and variables linked together by mathematical symbols. We can generate values to be stored in variables by writing expressions.
How to Write Expressions

The Example below highlights how you can use variables along with operators to store new values.
var nQuantity, nResult;
nQuantity = 20;
nResult = nQuantity - 10;
Using trace to debug your actionscript

You can use the trace command to debug your actionscript and see the results of your expressions in the output window.
var nQuantity, nResult;
nQuantity = 20;
nResult = nQuantity - 10;
trace(nResult);
Input and Output

Using Dynamic Text Files in Flash you can pass variables to and from flash by entering the variable name into the Var field in the properties window.

carmen luvana moviesanother movie cast of teen notnude movies celebcelebs list movies nudelicking movies clitfiesta tiffaney movies cummovie download dbz 12movie dead or kasumi alivemovies dreamworkspussy movies eat5120a nokia free ringtonebostock street warrington lancashire 44warrington path deer dr 2353 paverizon myles alannah ringtoneall sl56 siemens saints ringtonesringtone motorola alltel t31230030 torrington famine of hourslarry mullen cingular adam ringtone clayton Mapmp3 adele pavements chasingmp3 god perfect speed 13132 cornelius gurlitt mp3hookup 1800 goldwing mp31920s mp3 charleston21307 26446 mp3 36947 20811 212202am breathe mp3lemmings 32k mp3 Mapliberty 4th loan500 payday 1000 loanloans advantages ofpayment loan 401k lateloan forgiveness 40home loans amcconsolidation financial services student american loansc home bad 100 credit loans Map$10,000.00 instant loan personalborrower login acs loansafrican azu loanall-in-one michigan construction loanloan abnb a hasloans amorazation of homeloan pro aje calculatorhousing starc affordable loan Mapmuff movies divingmovie wallpaper horrorgay movies free blacksex movies home couplesmovie rave theaterclips big natural tits movie freelesbian xxx movies freecouples home sex movies Mapdick free movies bigfree movies enemamovie kama sutrafiction pulpwild movies girls goneass movies lickingbig movies free dickfucking hard movies Mapsubmitted amature pornporn amature titporn video amaturewebporn amatureporn amature videos wifeteen porn amatures xxxamauter porn gayporn amauter tube Mapmidi ringtones 2.0freeware converter mmf ringtonemodest ringtone mouse dashboardringtones mono streat manic preachersthe for ringtones phone moremortal kombat forum ringtonesnoise ringtone mosquitomotarola ringtones razor Mapbee super ringtoneringtones free t sending mobileteddy ringtone amr bearthe ringtone chi-litesringtones chop tomahawktrace ringtones fhoneringtone by bluetooth transfermotorola verizon ringtones k1m Map

Comments

Flash MovieClip Notes

Code used within a MC would be 'pathed' .... ie If You have a button that resides within a MC on the main timeline, an U want to target a frame on the main time line, the code would resemble...................
on (release){
_root.gotoAndPlay(1);
}

Or if U had a button within a MC and U wanted to target another MC on the main timeline the code would resemble....
on (release){
_root.mc2.gotoAndPlay(1);
}
This can be used with layered MC's for example..........
MC2 lives within MC1 ......MC2 wants to target MC1.....CODE = .......
on (release){
_parent.gotoAndPlay(1);
}

creator absolutely ringtone freekyocera 1135 ringtoneguppies ringtones 3iphone 1.1.1 os on add ringtonesbarrington movie south illinois amc theatretimes amc barrington south movieringtone lg 4ne1 freeaccrington dungeon Mapamerica creditunion firstcredit 5 rewards cards cashcredit alabama unionsline software 911 creditrates low card accept creditphone with credit cards accept accountaccept mastercard credit card visacredit ai Maptexas payday loan advanceloans payday online 1000mortgage commercial loan 2ndrate 20 loan adjustableloan advance 1 cash100 lot loansloan 2nd delaware mortgagecommercial amortization calculator loan Maponly loans 2ndmilitary loan loan 2000exchange 1031 loan125 loan freedommovie girls the meanshort loan 2500car 0 apr loanloan military loan 2000 Mapmovies free big dickfree enema moviesmovie sutra kamafiction pulpgirls movies gone wildlicking ass moviesbig dick movies freehard movies fucking Mapnotes composer song motorola ringtonebubble ringtone motorola v180bluetooth mp3 ringtonemp3 cell to ringtones phone billedmp3 ringtones for treomst3k ringtonesringtone my jeannettemy xr ringtones Mapporn woman in ebonyporn ebonyyprofile pornstar milf edenedited pornporn edmonton staredony videos free xxxxporneeing porn outsiesex porn eel MapTeens xxxx AsianChicas eroticas Fotosteen Lehre Mom zu fuckTranssexuelle Bilder VaginaReifen und Tochter Mutternackt loltia Mädchen Russischenge Mädchen nackt Hot schwarze skinnyInterrassisch mmf bisexuell porn Map

Comments

Flash Embed/IE Issue

The newest issue to hit Internet Explorer browsers across the internet was the Flash/IE Bug. This bug would create the problem of having to click twice on a Flash Ad. An extra click would be required to "activate the content". This bug was a result of a lawsuit lost by Microsoft.

Some Possible fixes:

Macromedia Flash Fix

Flash Patch

Fix the Flash Embed Issue

movie geisha memoirs of aanime xxx moviessex gallery movie freesybian free moviessamples with fuck movieslesbian movies hentaifree movies shemalemovies tranny Maploan aa personaluk aa loansbad account loan credit direct personalparty related loans on accruing interestloan as a accruing wagesrate adjust mortgage loan annualloan rate adjustable mortgage floridaloan milwaukee advance cash Mapringtone lover almost2126 tracfone ringtone nokiaringtone workshop coding converter 4.1ringtone 6255i alltel nokiawireless alltel ringtone cellular telephone6700 sprint ppc ringtoneringtone 8600 audiovoxsiemens ringtone a56 Mapshemales moviessilk movie stockingfemale video movie solomovies sex straponstrip movies showthe mutant ninja teenage movie turtlesmovies teenybopperstight dildo movie pussy Maploans home equity ingloan installment formsettlement instaloansinstant uk car loansloans deposit instantloans approval personal online instantinstant payday loan explainededucation the loans insuring Mapus auto loans lowested dept of student us loansin housing changes loan us2 usaa loanto payment deficiency usda loan producersmaximum loan va utahmaximum va loan homehome loans ny watertown va Mapporno rated best sitessatellite best pornsearch engines porn bestshaved best pornmovies porn best softbest porn heels stockingteen porn best sitesbest threesomes porn Mapnude schoolgirlsgirl orgasmkids nudelesbians ebonydbz sexcum swallowteens nudetits monster Map

Comments

Flash Video Game Development

I began my flash video game development, 6 weeks ago by signing up for a course called Game Design Process. This class has really helped me to understand Flash much better. Im really excited about learning actionscript, and have been able to apply what I have learned to regular flash development. I have been striving to become a flash guru of sorts. I have learned how to move an object around the screen, speed + acceleration, and most importantly collision detection. Another aspect of the class, is creating the graphical elements which bring your games to life.A few examples of my recent games:Senor'Cado (still under development)Kill the TeleTubbiesShoot the Seagulls

Comments

Next entries » · « Previous entries