Flash OOP?

This is a discussion on Flash OOP? within the Tech Board forums, part of the Community Boards category; So I'm getting into web development now and thus have to go with other languages and such, and of course ...

  1. #1
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717

    Flash OOP?

    So I'm getting into web development now and thus have to go with other languages and such, and of course Flash is one as it is capable of some fancy and exciting things, but just to help me with arguments later on and just so that I know, is Flash considered OOP or Object Oriented Programming?
    Thanks in advance
    Currently research OpenGL

  2. #2
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Non-technically... Flash is a program developed by Adobe (previously Macromedia) for devices, web browsers, etc. It uses a programming (or scripting if you prefer) language of choice called ActionScript (they could use anything), which versions 1 seemed to loosely resemble JavaScript, and versions 2 and 3 very much resemble Java. It's an OOP language.

    It's like Unreal games use UnrealScript, but they could just as well not use any scripting languages, or use LUA, or Python, etc. You wouldn't say Unreal Tournament 3 is OOP.

    That's going a little too far considering the Flash API's interface is exclusive to ActionScript, hehe. Most people know what you mean anyway.
    Last edited by Dae; 09-08-2009 at 02:33 AM.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Yep, actionscript uses classes and objects.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489
    Flash 8 or earlier uses ActionScript 2 which is similar to JavaScript.

    Hell you know JavaScript isn't meant to be OOP enough syntatically.

    In Flash CSx you'll use ActionScript 3 which is similar to C#, a little bit Javaish, more OOP semantics support and more restrictive than ActionScript 2.

    This restrictiveness even lead us to program with a better performance unlike the oldie.

    Btw OOP is paradigm, not a programming language specific.
    Just GET it OFF out my mind!!

  5. #5
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    If you want to do OOP for the web - look into Adobe Flex. It's just a collection of libraries for Actionscript, but you can write programs that are very java-esque or C#-esque and compile them to swfs. Very cool platform (and very OO) - it's what my day job is in, and I like it a lot.

  6. #6
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    I think AS3 is more than "a little" like Java. The API looks like it was copied line for line in a lot of places. C# takes after Java and C++ though, so actually they are all very similar.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  7. #7
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    ActionScript 2.0 to 3.0 are all object oriented versions of the 'language' However there are no destructors for classes which can be a pain. Also everything is a reference since there are no pointers...which means essentially everything is a pointer. But in the object oriented department it does fit the mold of many languages like it. It allows for maximum 1 derivation from a base (but there are ways around this), has access restrictions (public, private), has properties similar to C#, and has the same layout as C# in that there are no separate header files for the classes.

    Where ActionScript starts to fall apart in the object oriented department is how it interacts with objects on the stage. I guess if your SWF is going to be running inside of Adobe Flash this probably will not be an issue. I probably should not go any further with that discussion though.

    So while AS is object oriented depending on what is playing the SWF or what you are doing on the timeline in the FLA you may not be able to be as object oriented as you would like for performance reasons. AS overall feels very slow. I believe something like cos or sin takes on the order of 157 ms to compute in AS.
    Last edited by VirtualAce; 09-08-2009 at 11:40 PM.

  8. #8
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    I've heard about Flash's performance issues, yet I think it's the best solution for web stuff AND is nice to work with, I mean the application itself
    The public/private thing made it even more exciting as it's awesome, but if it lacks destructors ... I'll just have to live with that
    Currently research OpenGL

  9. #9
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,465
    IMHO, if you refuse to work on the timeline and instead code your SWFs entirely in the code editor, you will appreciate the language more.

    I found the timeline a major detractor from AS3 since it forces you to program things differently and apply a lot less elements of the language. There could be an advantage to it (faster development for instance). But my experience told me that to not be the case at all. The lack of features becomes so significant, that you really will only want to use the timeline for small and simple projects.

    That said, you will really want to take your apprenticeship from the ground up. So, do not take this advise at the moment. Just keep in mind that invariably your focus should shift from the timeline to the script language as soon as you feel comfortable with timeline-based SWF programming. Despite its sins, the timeline will provide you with fundamental concepts that are needed to better understand pure AS3 programming in the future.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  10. #10
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    I have done exactly one small simple flash app, using perl ming; the actionscript part was confined to simple arithmetic and for/while/if constructs. But one thing I learned doing that is that an .swf is just serialized data like any other image (of course, I guess it could not really be anything else). The structure of this file is not a secret (I have it in a book, I haven't looked around on line) so you could (maybe I will*) write a C program -- or whatever -- to assemble .swf files based on your input. Part of the file is the actionscript for use by the flash player, this may (or may not) be precompiled into an intermediate form, I will have to dig deeper -- but curious as to whether anyone else has tried something like this?

    Vis. Dae's comment that it looks like java -- it also looks alot like javascript. I imagine this is a good and intentional thing and IMO not unusual, since most people learning a language already know another one and will appreciate the similarity.

    * more likely I will just check out flex, but I kind of like this idea.
    Last edited by MK27; 09-09-2009 at 07:23 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  11. #11
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Actually a year ago Adobe released the specification for the SWF format. Before that there were indeed programs that cracked the format and released their own compilers/players/assembler/disassembler/etc. It's actually not exactly serialized, it's compiled into bytecode (like Python, Java, etc.). It can be quite complex sometimes, which you'd see if you looked into an encrypted SWF file. I'm hoping the bigger topic in the future will be a comprehensive open source solution to a cross-language, hardware-accelerated Flash API. The creators of Scaleform reverse engineered swf, re-created AS2 VM, re-binded API, and attached it to their GFX engine before the specification was even released. Wicked awesome, but expensive commercial license. They really own that market. Most flash solutions are just active-x, applet, drawing on a texture, etc. - buggy, inefficient, low access, high cpu, etc. Scaleform's actually suppose to be based on the work made by Gameswf though (like Gnash). Which was a nice start. There's a few forks but nothing substantial that I know of. I'm just anxious.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  12. #12
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Okay, great! Well here is a question then!

    The reason I gave up on ming was that it has been unmaintained for a while and predates ExternalInterface. If I can't interact with the page's javascript, then the usefulness of flash, for me, is severely diminished.

    So I have a few books out from the library on ActionScript and Flex, but NONE of them (at least in the index) refer to ExternalInterface or javascript! Has adobe restricted this so that you must actually buy MX or whatever in order to use those kinds of functions?

    Like, in short, will I be able to write stuff with flex that interacts with js in a sane way, or not?
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  13. #13
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    I have a lot of experience working with Scaleform and overall it's not bad as long as you use it correctly. That really is about all I can say about it in a public forum.

    But back on topic AS is certainly object oriented but Adobe's decision on how the stage and timeline are to be used feels a bit more like 'C' in AS instead of 'C++' in AS. AS 3.0 is certainly much better than 2.0 and 2.2 but it still has its fair share of issues. I've been to training both for Flash/AS and Flex and while they are good I must say that Adobe is insistent on doing things specifically their way instead of a common way both in their language design and UI/App design. In the end all it does is make their products harder to use since they do not follow any known UI patterns and often common object oriented language patterns. One thing that is very odd is the event system and gets even more bizarre when you attempt to pass an event to a movie clip yet receive the message at the level of a movie clip. One would think the clip would be self-aware but you actually must pass the clip in to the clip in order for the event to work. Also it is a bit odd how sprites are dealt with and does not lend itself well to any type of normal 2D sprite game development. What it ends up becoming is 'this is how you do it in Flash' and 'this is how you would do it without Flash'. It's almost the same as learning GDI graphics - the knowledge you gain is very specific to how GDI does things and not at all how the rest of the world does them. As such this creates a void in which Flash programmers feel that they can program a 2D game yet they fail to realize they can only code it inside of Flash b/c the principles they are using just do not apply outside of Flash and in pure C++ via OGL or D3D simply will not work.

    Adobe Flash CS4 also tends to crash quite a bit and the debugger for AS is horrendous. It was much better, IMO, in Adobe Flash CS3.
    Last edited by VirtualAce; 09-09-2009 at 09:00 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OOP flu
    By Hussain Hani in forum General Discussions
    Replies: 15
    Last Post: 06-27-2009, 02:02 AM
  2. Data Mapping and Moving Relationships
    By Mario F. in forum Tech Board
    Replies: 7
    Last Post: 12-14-2006, 09:32 AM
  3. recommendation for a good OOP book
    By Mario F. in forum C++ Programming
    Replies: 2
    Last Post: 06-15-2006, 04:28 PM
  4. OOP Theory Question
    By Zeusbwr in forum C++ Programming
    Replies: 2
    Last Post: 10-30-2005, 07:37 AM
  5. Flash <--> c++
    By c-- in forum C++ Programming
    Replies: 7
    Last Post: 09-13-2002, 11:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21