dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Code location

  1. #1
    Senior Member
    Join Date
    Feb 2007
    Posts
    153

    Code location

    Where do you put your code in flash ? Do you put it all on the main timeline ? Do you put in on the objects ? Where is the best place and why ? I followed a few tutorials where all of the code was on a layer in the main timeline (for arrangement). I kind of liked that but as I advanced in flash I started having problems with specifying the hole path for every movie clip (sometimes 7,8 embeded movieclips). I find it much more easier to just put the code on the movie clip itself. What is your method and why ? Are there any advantages/disadvantages for every method ?

  2. #2
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    its all about organizing stuff.........content should go on a layer named content ....actions go on a layer name actions script........for application based flash its best to put all code on frame 1 and use a single frame.........for an animation then its best to put code on the frame that the animation lives on but only code that pertains to that frames animation.......putting code on a movie clips timeline is best when you have alot of movieclips or when you just want to use that movie clips on enterframe event.....i have yet to use everything i have described above i just put all actionscript on the main timeline but diffrent layers....like i said before its mostly about organization.
    ~calmchess~

  3. #3
    Senior Member RangrJay's Avatar
    Join Date
    Sep 2005
    Location
    Las Vegas
    Posts
    163
    Above pretty much nailed it, its all about organization and ease of use.

    For instance in one of my recent projects I created a layout based on a vBNS cloud, with a lot of MCs. In this case, I opted to use MCs instead of Buttons based on usability. Any ways, for the 20 MCs that happened to be on screen, instead of putting an onRollOver, onPress, etc on every MC, i opted to create an AS file. This way anytime I needed to change an onRollover, etc event, I only had to change it in one place instead of on all 20 MC. On the MCs i just had one function that was called from within my Class file, creating all the event handlers in memory.
    Xero Patience Studios
    Web Design
    Software Development
    Graphic/Logo Design

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center