Flash: understanding program flow -


after reading tutorial of flash, still not sure program flow in general:

specifically, have demo of flash game (sort of super mario style). in have 2 types of weapon - simple fire , big fireball. reviewed code in order learn flash better [i new - since around monday week].

i saw program has variable keeps track of number of uses have left in each weapon. tried review places variable used couldn't find affects drawing onto screen.

i tried removing variable declaration , testing - may find references variable -- way convinient way of finding references variable/method/class [i using adobe flash cs5.5]? also, tried changing variables starting value "12" , noticed when test game, weapon has 12 uses indeed.

so problem: 1. seems variable somehow affecting drawing. yet, don't know how since code have found uses variable has nothing drawing. all, logic, like

if(var <= 0){     var--; } else{     return false; } 

where influence coming from?

  1. any way references variable [like in eclipse ctrl+shift+g]?

thank much.

flash can have code on variety of different things.

  • external classes
  • movie clips
  • frames

depending on tutorial put code on , of them , makes hard follow. in general best place code in external classes , on frames when absolutely necessary. as3, in fact, not let put code directly on movie clips avoid problem you're having.

i'm going assume you're using as2 because of problem of not finding code alongside of fact said deleted declaration of variable , still worked. (as2 lets away lot)

if unlock layers locked , select all, might find invisible movies appear dots. lots of bad tutorials put code on invisible movies run everything. deselect everything, select movie clip , hit [f9] pull action window see code.

the other option code on movieclip somewhere. start clicking on them , looking in action window see if there there.

no matter sounds you're using bad example. search as3 tutorials more optimized version of actionscript , prevents lot of bad practices you're seeing.

an as3 tutorial came accross


[edited]

to further answer question, program flow happens flash vm first firing onenterframe event movieclip can listen to. (in as2 call onenterframe on every movieclip. abandoned in favor of event class not have update on every frame) once has happened vm draws screen. more complete overview found website

your problem sounds contained in external classes. here's example


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -