• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 39. _global > Code Fix!

Code Fix!

_global.speed = 70;

// changes _global.speed
speed =+ 10;

function fasterPussycat(velocity)
{
      // this "speed" is completely
      // separate from _global.speed
      // because it's defined in a
      // function
      var speed = velocity;
      speed = velocity + 10;

      // how to use both?
      speed += _global.speed;
}

The comments explain most of this code. The fasterPussycat function (bonus points if you know the reference without Googling) uses both global and local variables. From any function anywhere in your movie, you can refer to _global.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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