• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Q&A

Q1: Attached to a clip instance, I've placed a startDrag wrapped in a “mouse down” clip event and a stopDrag inside a “mouse up” event. This seems to work fine. So why did we bother doing it with a button inside the clip?
A1: It may seem to work, but what you described will actually let the user drag the clip wherever he or she clicks—even if the user doesn't click the clip! The button was used because only buttons allow you to control where the user must click.
Q2:I put a Dynamic Text block onscreen that's associated with the variable “counter.” When I use the code counter=counter+1, I see 1s inserted at the end of the text block (not added). What's up with that?
A2: You're encountering a few things. First, the “+” operator both adds numbers and concatenates strings. You could try the code counter++, which effectively does the same thing. However, this won't work if you have a non-number in your text block initially (you'll likely see “NaN,” which means “not a number”). The issue is that numbers are different from strings. Flash figures that if something's in a Dynamic Text block, it's probably a string. Suppose someone asks you how many square feet you weigh. This doesn't make sense because the data types are mixed. Similarly, you'll encounter this kind of issue when mixing strings and numbers (two kinds of data). You can fix this particular problem with the Number function (for example, counter=Number(counter)+1).
Q3:I set the “IQ” property of one Movie Clip to 55 (with theClip.IQ=55) and another one to 120, but they don't look or act any differently.
A3: If you use one of the built-in properties (such as _x or _alpha), you'll likely see a change, but homemade properties are really just variables inside the clip. You can change them all you want, but if you want to see a change, you need to use those properties in conjunction with the built-in ones. For example, you could put a script in a frame or button that reads theClip._x=theClip.IQ * 10. This would locate one clip at the x-coordinate 550 and the other at 1200. (The asterisk performs multiplication.)


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint