A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: OOP Advice needed

  1. #1
    Senior Member
    Join Date
    May 2003
    Posts
    160

    OOP Advice needed

    I am in a class this quarter that covers OOP in flash mx. So far it's been pretty challenging for me because I have never used OOP before and did consider myself an intermediate at actionscript.

    Now i feel like i'm learning actionscript all over in some since. Does anyone have any tips to get me in the groove of OOP in flash mx? I see it's benefit to some extent, but it seems limited.

    Also for my final project I am wanting to use OOP to make a visual effects simulator, like Whitecap for winamp. Doesn anyone have any suggestions or links to help me learn to do visual effects in actionscript? thanks!

  2. #2
    Member
    Join Date
    Jan 2004
    Posts
    92
    here is a basic object in flash (i think)

    code:

    function object(x,y){
    this.x=x
    this.y=y
    this.add=function(){
    return this.x+this.y
    }
    }



    also, you can add functions to the constructor, so to speak, of exisiting objects, such as the movie clip.

    code:

    MovieClip.prototype.add=function(){
    return this.x+this.y
    }



    I hope this helps.

  3. #3
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,358
    There are a lot of tutorials that can help you out... good for reference and whatnot. Your class SHOULD be better than that you can find online though, if taught well enough (then again if it's for non scripters, things could be kept on the easy side).

    Here is an OOP tutorial that should be able to help:
    http://www.kirupa.com/developer/oop/index.htm

    And I have a lot of posts listed here covering some of the more in depth OOP convos Ive been involved with, one of which, here on Flashkit, is very deep (the one entitled "__proto__ etc. (in depth)"):
    http://www.kirupaforum.com/forums/sh...threadid=29586


    As for your visual effects simulator, that may not be the best project to look to putting your OOP skills to. To get effects like that out of Flash, you'll need to use a 3rd party tool to convert audio into a swf with the audio and another "track" of the spectrum values which can be extracted from the swf when its loaded and played. The visualization is then just something that reacts to numbers. Not much OOP involved in that.

  4. #4
    Member
    Join Date
    Jan 2004
    Posts
    92
    whoooaaa, i totally forgot about that. you can have objects in flash, i havent done that in such a long time. so sorry to mislead you man, totally slipped my mind. the most i ever needed with objects in flash was storing vars and that was enough...

  5. #5
    Senior Member
    Join Date
    May 2003
    Posts
    160
    ya velcrobandit that's all i have done in the past. i am having a bit of trouble seeing the benefits of OOP in flash, maybe someone can explain?

    thanks senocular for the links! the visual effects simulator idea wasn't going to play to music like whitecap, rather just by eye candy. i was thinking you could basically click a link and it would show some wierd visuals in the flash movie and click another to overlay another effect on top of it.

    do you have any suggestions for a good OOP project?

  6. #6
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,358
    one of the links in the second link I gave does. OOP "creatures" exercise.

    OOP is helpful when you're dealing with multiple "objects" which need to behave similarly. These objects can be structures for holding information like a bank account, or movieclips on the screen like flies in a swarm. Instead of writing the definition of each object manually, the OOP approach allows you to do 1 outline and just fill in the values of that outline with a new Object(...) call. That makes it much easier to create and ultimately manage your many objects... If you read through that first link, there's more on what benefits OOP provides.

  7. #7
    Senior Member
    Join Date
    May 2003
    Posts
    160
    thanks, i started going throught the first link already. are games a good idea to use OOP for. i was thinking of making a game for class.

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