This blog has moved to a new location! http://iqandreas.github.com/
Showing posts with label adobe. Show all posts
Showing posts with label adobe. Show all posts

Thursday, June 3, 2010

What is the point of this Blog?

I recently had to write a summary of the blog, and thought it might be a good opportunity to repost this information here and make it clear to all my thoughts and purposes of this Blog.

This blog is a collection of information focused mainly on ActionScript and Flash, with emphasis on game development, plus a little bit extra thrown in. It is aimed to be readable by beginners and not only experienced developers.

Articles are typically in one of the following categories:


The posts also strive to be unique. "If you can find it from 100 different sources on Google, there is no use in reposting what is already out there." Though, I may link to good articles, but I try to avoid writing repetitious information, clogging up the already very filled internet.


If there is any part of ActionScript you want more information on, or have an idea for a good blog post, leave a comment in the section below. A blog isn't much use if the information is irrelevant to it's readers.

Cheers,
Andreas J. Renberg
http://iqandreas.blogspot.com/


And now on to SWF Protection! :)

Monday, May 24, 2010

Steve Jobs responds regarding Flash

"We also know first hand that Flash is the number one reason Macs crash." [...] "Perhaps Adobe should focus more on creating great HTML5 tools for the future, and less on criticizing Apple for leaving the past behind." — Steve Jobs

Finally, someone from Apple responded to war on Flash in an official statement — Mr. Steve Jobs himself! That letter can be found at http://www.apple.com/hotnews/thoughts-on-flash/

In the letter, Steve Jobs points out six main points why Flash is the enemy that has infested the Internet, and must be weeded out and slaughtered before it kills us all. Here I list the "abbreviated" version of his letter without any personal opinions or replies; I'm saving those for later.

First, there’s “Open” Adobe's products are 100% closed and proprietary. Adobe updates when THEY want to, and sets whatever prices they like. Although Apple has closed products, standards like HTML5, CSS, and JavaScript are entirely open and available to all, and therefore all work with Apple's products.

Second, there’s the “full web”. Almost all popular video on the Internet can be viewed in a newer, more modern format, H.264. Even though users cannot play flash games, there are over 50,000 applications in the App Store, and many of them are free.

Third, there’s reliability, security and performance. Symantec recently highlighted Flash for having one of the worst security records in 2009. We also know first hand that Flash is the number one reason Macs crash. We don’t want to reduce the reliability and security of our iPhones, iPods and iPads by adding Flash. In addition, Flash has not performed well on mobile devices.

Fourth, there’s battery life. Most Flash video is saved in formats which need to be decoded first; this takes up valuable battery life. On an iPhone, H.264 video can play for 10 hours until the battery dies, while most other formats only last the battery 5 hours.

Fifth, there’s Touch. Flash was designed for PCs using mice, not for touch screens using fingers. Apple’s multi-touch interface doesn’t use a mouse, and there is no concept of a rollover. Most Flash websites will need to be rewritten to support touch-based devices.

Sixth, the most important reason. Apple doesn't want any third party standing in between the developer and Apple. If Apple releases new updates, the users have to wait until the third party has updated their software to match, and are at the mercy of the third party. Although Flash is intended to be "cross-platform", Apple is very much against this thinking. Apple wants all their apps MADE FOR the iPhone or iPad, optimized with all the features available to "iProduct" developers, not available to iProducts as a "side feature".


Some of Steve Jobs arguments are a little shaky, and a lot of the time, he is pointing out a flaw in Adobe, while four fingers are pointing right back at Apple. But I'll post counter arguments and opinions on the matter another time.

This article is part 2 of 3 in the series "The Apple vs. Flash Wars"
  1. "Go screw yourself Apple" — Lee Brimelow
  2. Steve Jobs responds regarding Flash
  3. Thoughts on the Steve Jobs reply [in progress]

Sunday, April 25, 2010

Getting started with Flash Player 10.1

Flash Player 10.1 added several neat multi-touch, gesture, and accelerometer input features. There are several more neat features of the new Flash Player, but the new input controls are what I find the most captivating (that, and global error handling, FINALLY!). The rest can be found on Adobe's website:
AdobeLabs - Flash Player 10.1 Features and Enhancements

Adobe really put a lot of effort into getting the newest version of Flash Player to work on numerous devices, naming this project the "OpenScreen Project". Quoting Adobe - "With support for a broad range of mobile devices, including smartphones, netbooks, smartbooks and other Internet-connected devices, Flash Player 10.1 allows your content to reach your customers wherever they are." [side note - sadly, iPhone support was shot down]


Flash Player 10.1 is still in the "prerelease stage", meaning it is not released as an "official" or currently updated version just yet. I'm not sure if bugs are being ironed out, or if Adobe mainly wants to wait until Flash CS5 is out. However, the new player is still available for developers who want to test out the new features.

So far, FP 10.1 seems to be working just fine for my every day uses, and haven't run into any major bugs yet. In fact, (since I'm in Linux still) the old Linux Flash Player (version 10.0.45.2) had several bugs which were never ironed out, and according to several Google results were quite common. However, with the new version, those bugs seem to be gone (at least so far):
[Solution] Flash sound stops working in FireFox on Linux Ubuntu 9.10
[Solution] Adobe TV crashes FireFox on Linux Ubuntu 9.10


Since 99.8% of your site/application/game users won't have version 10.1 installed, I really don't recommend using it for your sites just yet. However, if you have a phone or computer with multi-touch capabilities it might be fun messing around with the new features. In addition, if you read up on the classes and functions enough now, by the time it is fully released, you can be first in line when clients are looking for the newest features for their product.


So, where do I get started?

FIRST, you need to download the actual Flash Player 10.1. As with Flash 10, the browser and standalone versions are two different things, so if you update the browser player to 10.1, the standalone player will still be the old version and vice versa, so unless you plan on keeping the old player for any specific reasons, remember to update them both.

There is also a difference between the debug version and the regular version. Basically, the debug version is good if you do a lot of testing, since the error messages show up as dialogs, along with several other features not available in the "regular" release of the Flash Player. Otherwise, errors are silently ignored, which is good for regular users, but really annoying if you can't get your code working right, and you are having a hard time figuring out what's going wrong and where.

All versions of the player can be downloaded here:
http://labs.adobe.com/downloads/flashplayer10.html


THEN, all you need to do is download the new SWC library with all the new classes. I'm pretty sure they are just the "shells" for the classes which expose all functions and properties rather than contain actual code, just as the ActionScript files for MovieClips don't contain the actual code for them, but just expose functions to allow code hinting etc for developers. [a VERY good read on the matter]

I was worried I would need an updated compiler, but to my joyous surprise, you can still keep using Flash Professional, Flex Builder, the Flex SDK, or whatever compiler you use without any modifications. There should be dozens of tutorials on importing SWC libraries into your current editor, but if you can't find anything relevant, ask in the comments section, and I will lead you in the right direction. Don't forget to post what type of IDE you are using (Such as Flash Professional CS4 or FlashDevelop etc).

The SWC can be downloaded on the same page as the Flash Player (how convenient)
http://labs.adobe.com/downloads/flashplayer10.html#pgswc


Downloaded and ready! Teach me how to use it!

Sadly, I don't have any tutorials for it (I don't have a touchscreen or even a mobile device newer than 10 years old) but several others out there have already put up tutorials for FP 10.1 development.

gotoAndLearn - Multi Touch Gesture Applications
Multi Touch in AS3 / Flash Player 10.1 - Part 1. Setting Up
Multi Touch in AS3 / Flash Player 10.1 - Part 2. TouchEvent & MouseEvent Sequences


I'm in need of a lot more tutorials and examples, so if you know of any other good sources, or have written any good tutorials yourself, just leave a link in the comments section! :)


Some further reading

As always, I am never the first to write about things, so here are some helpful links which hopefully helps someone out there.

Adobe Labs - Adobe Flash Player 10.1
Introducing Adobe Flash Player 10.1 public prerelease
Flash Player 10.1 prerelease software demos and interviews
Adobe TV - Multi-touch capabilities of Flash Player 10.1
Kirupa Forums - Disappointing FP 10.1 First Impressions
TourDeFlex - according to Adobe, some examples should include some FP 10.1 features as well. Still very neat if you haven't used it before!


Good resources for FP 10.1 development

Keep these links in your toolbox. They usually come to use quite a bit:
ActionScript 3.0 Language Reference (with updates for Flash Player 10.1)
ActionScript 3.0 Developer's Guide (also with FP 10.1 updates)
Adobe Forums - Flash Player 10.1
Adobe Bug tracking and management - On case you do find anything wrong with the new version. When submitting, remember to check for existing bugs, as chances are you aren't the first person ever in the world to run across that bug. ;)



If anyone has any demos of what they have accomplished with the new features in FP 10.1, leave a comment and share your work with others (source code is appreciated, but not required). I will provide the SWF hosting if you require it.

Tuesday, April 13, 2010

"Go screw yourself Apple" — Lee Brimelow

"Go screw yourself Apple" — Lee Brimelow

Instead of just adding to the oodles of posts out there on Apple's recent move with just another long hateful rant, I will just add my two cents in little paragraph, as well as a few good reads on the matter.


What are you talking about?

Okay, let's start from the beginning.

In the past, to develop iPhone apps, users had to download the "free" (note the quotes) SDK from Apple, which ONLY runs on MAC. In addition, developers had to pay $99 per year to Apple and join the "iPhone Developer Program" in order to publish their apps to the store. The only way to put iPhone apps onto your iPhone is via the apps store (unless you jailbreak the phone, but that may void your warranty)

This was the only way to develop games and applications on the iPhone, and some companies would offer to port the games for a fee.

On October of 2009, at the Adobe MAX conference, Adobe announced that Flash Player CS5 will have the ability to export Flash games and applications to a format that can run natively on the iPhone. Natively means no slow interpreters or emulators, but direct compiling to the iPhone's bytecode. [Ryan Ragona's comprehensive blog post, Lee Brimelow's video, and Adobe's official iPhone apps site]

The compiler upgrade in CS5 was VERY exciting for developers, as not all developers have the time or money to port all their games to the iPhone format or go through each line of code and translate it to Objective-C.


Wohoo! Now even I can make iPhone games!

Not so fast, I haven't come to the bad news yet.

Early April 2009 Apple announced that it is illegal (or whatever legal term they used) to compile your iPhone applications using any other tools then their SDK.

Wednesday, April 7, 2010

[Solution] Adobe TV crashes FireFox on Linux Ubuntu 9.10

I have no idea why, but whenever I would access AdobeTV, as soon as the video started loading, FireFox would freeze up and need a restart. Every single time.

This would happen on a completely clean LiveCD system as well as the full installation with the following specs:
Ubuntu Linux 9.10
FireFox 3.5.8 with no extra add-ons installed
Flash Player 10.0.45.2


Instead of debugging and finding the source of the error, I took the easy way out and installed Flash Player 10.1 (currently in Beta I believe?)
http://labs.adobe.com/downloads/flashplayer10.html


Perhaps the new Flash Player version will also fix some other issues I have had:
  • Playing sound stops working completely, and needs a browser restart in order to work again  [Yep. Fixed!]
  • SWF projects using computeSpectrum will not work (the sound plays, but it doesn't do anything on the stage)  [Hm... Still seems to not work...]
  • In the standalone Debug version of the player, even if you hit "Dismiss All", some errors will show up again, and no matter how fast you dismiss the errors, the dialog will keep popping up, forcing you to kill FlashPlayer manually  [No problems so far] 
  • Constant "flickering" between layers when playing games or apps with several layers  [Problem persists even in FP10.1]

I could file a bug report for these old problems, but considering how much Adobe ignores Linux users, I doubt they would go back and update Flash Player 10.0 for these fixes. Instead, I'll file bug reports only if I receive problems in the new version.

Thursday, March 25, 2010

Getting started with Flex/Flash Builder on Linux

"Windows Restore cannot continue. Please contact the manufacturer if this problem persists."

With those words I realized that my temporary fling with Linux had gone from a fun single date to a forced marriage proposal and an unexpected commitment. Yep, I am stuck with Linux for a while, and hopefully not for an entire 9 months.

It's not that I hate Linux, in fact I love using Linux, but I'm never getting those three hours of my life back spent on trying to get Flash CS4 working in Wine.


Instead of sitting on my hands doing nothing, I'm going to get back to Flash development. Since Flash Professional CS4 is now out of the question, I guess my next logical option is Flash/Flex Builder.

For anyone else getting started with building for Flash Player or AIR on Linux, I have compiled a small pool of information, so you don't have to dig through dozens of different sites for hours trying to make heads and tails of it all and sort it all out. Note that I have only been working with Flash in Linux for about two weeks, so please correct me (by leaving a comment) if I give any faulty or incomplete information.


What is Flex Builder 3 for Linux?

First of all, Flex Builder (now renamed Flash Builder so it won't be confused with the Flex SDK) is a plugin that Adobe developed for the already popular development environment Eclipse. Most of the features, such as code hinting, were already developed by the Eclipse team, so Adobe can safely charge almost $300 for relatively little effort. Of course, they also added a few new features to the plugin beyond Eclipse's current capabilities, and they didn't charge the full $700 for Flex Builder, so I will cut them some slack.

In an effort to connect to developers of all platforms, (and considering how Eclipse is already available in Linux, all they had to do was update the plugin to match) Adobe released Flex Builder 3 for Linux (currently alpha version 5). Note that Adobe considers this plugin separate from the "regular" Flex Builder. According to Adobe, "Although many of the features in Flex 3 are included in the Linux release, there are several features that are not yet included. Our main goal is to get the base features in place and then to solicit user feedback and their priorities for additional features, such as the profiler or design view."

Although it sounds like Adobe is making a great effort at making this world a better place, Adobe seems to have abandoned the project. Aside from releasing the alpha 5 version in November of 2009 that extended the trial period (from 1 Dec, 2009. I'm not sure of the new trial expiration date), there hasn't been any updates for Linux users since April 2009.

Despite the recent release of Flash Builder 4, Adobe still has not updated the Linux version, and the reply of choice when asked is "Adobe has not yet announced a release date for the Flex Builder Linux product."

Am I being too hard on Adobe? If you feel offended, please tell me, and then show me what progress they have made and steps toward finishing the Linux version. Then I will go back and correct any hateful remarks.


That's horrible! We need to do something!

The valour is honourable, and if you really feel like it you can vote on this bug:
http://bugs.adobe.com/jira/browse/FB-19053
However, unless you hold a major share of stock in Adobe, I doubt they will do anything about it. They will either drop the project, or will reinvest in it once it becomes obviously financially beneficial to them.


Oh well, I guess FB3 Beta is better than nothing

That's the spirit! The FlexBuilder trial can be downloaded from Adobe's site:
http://labs.adobe.com/technologies/flex/flexbuilder_linux/
The installation process is pretty straightforward. Remember to have Eclipse installed first, as the installed only includes the plugin. Eclipse can be found here:
http://www.eclipse.org/downloads/

WARNING: Several people have trouble installing the plugin on Eclipse version 3.5! (including me at first) Although there are fixes for this, it might be better to install version 3.3.

In Ubuntu, it should be as simple as going to "Applications > Ubuntu Software Center" and installing it from there (worked for me). If Eclipse doesn't show up in the list of available programs, make sure you have marked all the software sources in "System > Administration > Software Sources". If you have any problems, this walkthrough might be able to help (he beat me to writing the tutorial):
http://kbala.com/install-adobe-flex-builder-linux-alpha-in-ubuntu/
(and a second tutorial in case the first one wasn't enough)
http://www.insideria.com/2008/04/step-by-step-setting-up-flex-b.html


What about Wine?

I'm not complaining that much about Adobe... oh... you mean. Yes, I see now. My failure with Flash Professional and Wine caused me to give up, and I didn't even think about using it with Flash Builder. This section wasn't even added until after my try with fb4linux, so I have not personally tested this yet.

According to their website, Wine should be able to emulate Both Flex Builder 3 and Flash Builder 4 fairly well. It's definitely worth checking out.

This guy seems to have accomplished it, and has written a guide:
http://diariolinux.com/2009/06/22/how-to-install-flash-builder-on-linux/


So what other alternatives are there?

One name that appears a lot is Aptana (which I believe is free) and also Eclipse based. I still have not tried it, and I'm not sure how full fledged it is, so I would really appreciate any opinions on it or trustworthy reviews of it to link to.

Another one I have seen links to is IntelliJ IDEA, however, this one has a price tag of $249. They have a free "community version" on their site, but I have no idea of the difference between the two. According to their site, it should incorporate well into Flex without any major modifications. [source] This one I have not tested either, and would really appreciate any reviews.

AXDT seems to be another Eclipse plugin. No experience with that one either, but it uses the Flex SDK, so it should have about the same amount of features as if you were using FlashDevelop and the SDK.

FlexBean another plugin, but this one for NetBeans. Likely similar to AXDT.


Screw Adobe! I want Flash Builder 4 in Linux now!

I was hoping you would want that. Finally, there is Flash Builder 4 Linux (I'm not sure if the 4 is to match the version number of the newest Flash Builder, or if it's supposed to read "for").

This release is NOT by Adobe. This is a port of Flash Builder to Linux. I'm still not sure exactly how it is ported (possibly because Eclipse plugins are operating system independent due to being Java-based, and all they did was copy the data from the Windows version to the Linux version, however, I believe there was a bit more involved)

If you need hand with the installation, this site has a small tutorial:
http://mayboroda.blogspot.com/2009/11/flash-builder-on-linux.html


What now? It's installed, I want to learn Flex in Linux!

I'm still trying to dig up links for this. The good thing is most tutorials that work for Flex Builder should work just the same for the Linux version.

I have however found one video that specifically names Linux - Getting started with AIR on Linux. It's 'hosted' by Mike Chambers, and even though he says he has planned on releasing future tutorials on Linux development, I have not found any. GotoAndLearn has several other great videos on Flex development as well.


Additional reading

You could get these yourself from Google, but then you have to sort through which ones are on topic and which ones are just wasting bytes on a server.
http://gruchalski.com/2009/04/22/flex-builder-3-for-linux-on-hold/
http://www.infoq.com/news/2009/05/flex-builder-linux-dead
http://rachaelandtom.info/content/flex-builder-linux-canned-and-how-you-can-help-get-it-going-again
http://www.insideria.com/2009/06/flex-builder-linux-and-open-so.html


So what about you? Can we expect more Linux tutorials?

Definitely! If Windows keeps being evil, I'm likely to stay in Linux for a while, so hopefully I can be of some help to others who are also using Linux and developing for Flash.

I'm in the process of downloading Flash Builder 4 Linux right now, so I will give a full review and maybe even a guide some time soon!

I also got my hands on SWF Protector. Thank goodness they have a Linux version. Once I get everything up and running, I will give my thoughts and hopefully also a performance evaluation on how well it runs. There will also be both a drawing and a competition for free licenses, so stay tuned!


Any links or alternatives I missed?

Tuesday, February 9, 2010

The Language Reference at the tip of your fingers!

There is no question or dispute about it,
If you want to be a good ActionScript developer, you need to learn how to use the ActionScript 3.0 Language Reference. (Unless you have decided to do all your coding using only primitives...)
I'll write a guide on how to use the language reference some time in the future, but until then, it still needs to be convenient and easy to get to. I will show you how to save the language reference to your hard drive (faster than loading it in from the internet, and then it's also available when you are offline!), and then add it to your bookmarks toolbar.

The end result will look something like this:



I will be using FireFox (version 3.5.7) running on Windows XP. It should be fairly straightforward, and pretty much the same for any browser or operating system, but if you have any difficulties, leave a comment. If you have gotten this to work in a different operating system or browser, please share your results.


Step 1 - Find and download the ActionScript reference from Adobe's website

The newest version of the language reference can be found at:
http://help.adobe.com/en_US/AS3LCR/Flash_10.0/index.html

Note that Adobe often throws around and rearranges their site, so if that should happen, this site will always link you to the most up to date version of the language reference:
http://tinyurl.com/ykacx95


About at the bottom of the page of the online reference, it should say something like "Download a standalone ZIP file version of this reference, including its own local search for offline use, here:" with a link to the ZIP. The current link is as follows:
http://help.adobe.com/support/documentation/en/flash/10/ActionScript3LangRef.zip

Save that ZIP file (about 6MB) to your desktop, and proceed to step 2...



If you are using Flash CS3, the online version of the language reference can be found here:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/

I can't seem to find a downloadable ZIP, however, if you installed CS3 correctly, the language reference should already be stored on your computer in the following directory:
C:\Documents and Settings\All Users\Application Data\Adobe\Flash CS3\en\Configuration\HelpPanel\Help\ActionScriptLangRefV3\index.html


If you are using any other version of ActionScript (such as AS2, Flex, FlashLite etc), the entire list of avialable language references can be found at:
http://www.adobe.com/devnet/actionscript/references/
However, it seems that only the Flex Language Reference and the Flash CS4 Language Reference can be downloaded as ZIP files. Sorry. :(



Step 2 - Extract the ZIP file to an appropriate location

If you can't do this one on your own, you have more to worry about than learning ActionScript.

You can extract the directory to any place that is convenient for you, however, if you decide to move it later you will need to redo the entire procedure, so choose wisely!

Some recommended directories:
c:\Documents and Settings\All users\Documents\AS3 Language Reference\
c:\Documents and Settings\All users\Application Data\Adobe\AS3 Language Reference\
c:\Program Files\Adobe\Flash CS4\AS3 Language Reference\
c:\Program Files\Adobe\AS3 Language Reference\
c:\Program Files\Mozilla Firefox\AS3 Language Reference\
c:\Programming\Flash\Language References\AS3 Language Reference\
c:\AS3 Language Reference\

I will be using the first option for this tutorial as it will be the least likely to be overwritten in case any programs update.


If you are using CS3, play it safe and keep the language reference in the directory where you found it. If you want to have it elsewhere, make a copy.



Step 3 - Add "index.html" and "all index pages"


EDIT: For some reason the context menu option "Open selected links in new tabs" seems to have disappeared, so in order to continue the tutorial you need to install one of the following add-ons:
Linky - https://addons.mozilla.org/en-US/firefox/addon/425
Multi Links - https://addons.mozilla.org/en-US/firefox/addon/13494
Snaplinks - http://snaplinks.mozdev.org/installation.html

For this example, I will be using "Linky", but you are free to use whatever plugin you prefer.


In the directory you downloaded the language reference to, open the "index.html" file into FireFox (or whatever browser you are using).

The site's url should say something like
file:///C:/Documents%20and%20Settings/All%20Users/Documents/AS3%20Language%20Reference/index.html

And you should see a page like this

The main index page for the ActionScript 3.0 Language Reference

To begin, bookmark "index.html" and rename it to "Main Page" or something and place it in a new bookmark folder named "AS3 Language Reference".

For convenience, I added the bookmark folder directly to the "Bookmarks Toolbar", but you can keep them hidden away in the plain old bookmarks menu if you prefer.


Next we will be adding a "search feature" (more like an index with CTRL+F) Remove the "index.html" text from the url bar and hit enter. This should bring up the folder contents in FireFox with the following url:
file:///C:/Documents%20and%20Settings/All%20Users/Documents/AS3%20Language%20Reference/


Select all the links you see from "all-index-A.html" to "all-index-Z.html", right click the selection, and (at least in Linky) choose "Open selected links in tabs". After a while, you should have 27 new tabs opened. You can close down the "folder view" so it doesn't get included when bookmarking.


Go to "Bookmarks > Bookmark all Tabs..." or hit "CTRL+SHIFT+D". Choose where to store these bookmarks, and name the folder for them something like "Search". It may take a few seconds, but once the bookmarks are saved, you can close down those pages. This is easiest by just closing and reopening the window, but if you have TabMix Plus plugin installed, there is a very handy "Close other tabs" option.

Linky - open selected links in tabs

Save all tabs as bookmarks

A quick alphabetical index of classes, properties, and functions is now available in your bookmarks


For the next steps, you will be repeating this procedure quite a bit.

Also, if it makes it easier, you can add the root folder where the language reference is stored as a bookmark as well (I named mine "Browse Folder")



Step 3 - Add the packages


Next we will be adding the following packages as sub folders of the bookmarks menu:
adobe.* (only a few files)
air.* (if you don't develop in AIR at all, you can ignore this one)
fl.* (Flash components)
flash.* (All the actual class files - this one is the most important!)

This part is the one that takes the longest. Unless you have a trusty army of Oompah Loompahs to do the job for you, prepare to take out at least half an hour in bookmarking them all. If you have a short attention span, bookmark them small parts at a time over time.

In any order you like, start by opening one of the subfolders with the matching package name, and in most folders, you will need to open an additional sub-folder package.

I'm going to start with "flash.accessibility" (in folder "flash\accessibility\") and start working down the list in alphabetical order until the entire flash directory is added.

Use Linky to open the list of classes into your tabs


Keep doing this to all 4 folders (and their respective subfolders) until you get an organization something like this in your bookmarks toolbar:

Browsing for the documentation for flash.display.MovieClip


Wohoo!! Almost done... (After all that you probably don't want to see another bookmark again, but bear with me. It is definitely worth it and VERY convenient once it's done!)



Step 4 - The global package and Appendix



There are several classes just laying their in the main folder that don't have a package. You could add them directly to your bookmarks toolbar, or you can group them into a new "global" folder to avoid clutter.

Better organized global classes and functions bookmarks

I found, the easiest way to track down all global classes, instead of guessing which ones are classes and which ones are just HTML pages, open the page named "class-list.html". It will contain a list of all the global functions and classes.

Note that even though the classes are organized into separate HTML files, the global functions are all stored in one single HTML file (named "package.html"). So, instead of selecting all links on the page, only select the classes, and bookmark them. After that, go back and bookmark "package.html". If you have any use for it, you can also bookmark "package-classes.html", which is basically a list of all classes and functions in the top level package.

You can even add the pages "operators.html", "statements.html", and "specialTypes.html".


Finally, the Appendix ("appendix.html") contains pages such as a list of errors and what they mean, some AS2 to AS3 migration help, and other information. You can either add this single page and bookmark it, or select all outgoing links and bookmark those instead, creating a subfolder named "Appendixes".


The only page left is "conventions.html", and unless you will be checking on it every few days, I wouldn't bother adding it as most of the Language Reference conventions are quite self-explanatory anyway.



Last thoughts



So, that's it. If you did everything right you should have a bookmarks menu which is easy to navigate around in, and has really helped me at times.



An added bonus is that if you start typing in something in the address bar, FireFox will automatically recommend pages in your bookmarks.
Firefox will auto-complete any text you type in with a class in the language reference from the bookmarks if a match is found


I'll create a post in the near future which better uses the "search" ability of the language reference, but that is yet to come.

Thursday, September 17, 2009

Wii Internet Channel now supports Flash!

Good news developers! As a followup to my earlier (rather short) post regarding future Flash support for the Wii, it seems as though my hopes have come true (mostly).

I recently was able to get my Wii connected to the internet again, when I stumbled upon a notice that the Internet Channel had a new update available. Curious, I prowled the web for any information regarding this new update. Sadly, I found no official source, however the Internet Channel's Wikipedia page state:
"In addition it updated Flash Player to Adobe Flash Lite 3.1 which corresponds to a full implementation of Adobe Flash version 8 with certain features of Flash 9." -- Footnote: The Wii Browser now Identifies its self as "AFL 9,1,122,0" to Flash applications as can be seen by visiting
http://kb2.adobe.com/cps/155/tn_15507.html in the Wii Browser.

So, Flash Lite, that is a great start on Nintendo's part. Sadly, it doesn't contain the fancy 3d features of Flash 10 or even the Vector class I love so, but it is a start.

For people wanting to start developing in FlashLite, it is basically like regular ActionScript, but 'stripped down' missing several libraries. If I can find some time I'll try to track down a list of what classes FlashLite is lacking.

Until then, here are some helpful links for aspiring FlashLite developers:
Adobe's FlashLite FAQ - http://www.adobe.com/products/flashlite/faq/
Adobe's "Getting Started With FlashLite 2.x and 3.0" - http://livedocs.adobe.com/flashlite/3.0/docs/help.html?content=Part4_API_Ref_1.html
And of course, my favorite, the Language Reference, can be found on that same page as listed above.


Also, as a final note, here are a last few Wii/Flash links I have yet to look into which look (at least two of them) promising:

WiiFlash (http://wiiflash.bytearray.org/)
Connects directly to the WiiMote using your computer's BlueTooth connection, and accesses it from Flash through your localhost address. Pretty smart. :) That would be a great workaround for many features not currently available natively in Flash. I seem to be getting "Security Sandbox" errors, but it seems like it's working for other people. Not sure if it works in online games, though.

WiiCade API (http://wiicade.com/home.aspx)
There is supposed to be some sort of support for which allows you to use the "arrow buttons" on the Wiimote as if they were the WASD keys on the keyboard. I'm not sure how they pull it off, and current games look quite crappy and cheap. If anyone has any experience in using this API, please comment.

Wii Opera SDK (http://wiioperasdk.com/)
It looks like a thirteen year old who just learnt how to use FrontPage developed the site, so I can't help but be a little suspicious. I have no earthly idea what kind of support this has, so again, any outside comments are appreciated.

Wednesday, September 9, 2009

Error: Error #2071: The Stage class does not implement this property or method.

Error: Error #2071: The Stage class does not implement this property or method.
at Error$/throwError()
at flash.display::Stage/set x()
at Untitled_fla::MainTimeline/frame1()[Untitled_fla.MainTimeline::frame1:1]
Similar to Error #2069, Error #2071 occurs when you try to set stage properties that have been overriden.

To quote the ActionScript 3.0 Language Reference:
Quote:
In addition, the following inherited properties are inapplicable to Stage objects. If you try to set them, an IllegalOperationError is thrown. These properties may always be read, but since they cannot be set, they will always contain default values.
  • accessibilityProperties
  • alpha
  • blendMode
  • cacheAsBitmap
  • contextMenu
  • filters
  • focusRect
  • loaderInfo
  • mask
  • mouseEnabled
  • name
  • opaqueBackground
  • rotation
  • scale9Grid
  • scaleX
  • scaleY
  • scrollRect
  • tabEnabled
  • tabIndex
  • transform
  • visible
  • x
  • y
Logically thinking, you can't really set the x, y, or rotation values of the stage, since it is supposedly "God", what everything else in Flash is measured against. Sure, if the user is running a SWF as a projector or through the debugger, they can move the dialog box around, however, this doesn't really change the x and y values of the stage, as the stage will still always be at 0,0 inside of its container.

If you want to measure any farther, you will have to start measuring in the operating system's coordinate space. That's going a little too far, and is even outside of Flash's capabilities.

Also note that the following stage properties are overriden, and throw errors if you try to set them. These are different than the properties listed above because they will hold actual values, not just the default ones, but you are still not allowed to modify them.
  • height - can be read, but throws an IllegalOperationError if set
  • width - can be read, but throws an IllegalOperationError if set
  • stageHeight - is able to be set, and will not throw an error, but it seems as though changing this property has no effect on the stage, at least not when run in the Debugger Player
  • stageWidth - is able to be set, and will not throw an error, but it seems as though changing this property has no effect on the stage, at least not when run in the Debugger Player
  • textSnapshot - cannot be read or accessed. Should be in the list above, but I'm not sure why Adobe didn't include this property to the list.

NOTE: Unless you like boring nitty gritty details, you can just stop reading right here. The rest is just for reference.

In addition, some properties and methods cannot be run outside of the stage's security sandbox without the proper permissions, so those methods are overridden just so Flash can check their security credentials. They act just as the regular methods they override with the difference that they will dispatch a SecurityError if accessed by an object outside of the current sandbox.

The affected properties all have to do with children and are "mouseChildren", "numChildren", and "tabChildren". The affected methods that have to do with containing children are addChild(), addChildAt(), removeChild(), removeChildAt(), setChildIndex(), and swapChildrenAt(). Finally, the only other affected methods have to do with Event Dispatching, and are all overriden for security checks; addEventListener(), dispatchEvent(), hasEventListener(), and willTrigger(). Strangely enough, removeEventListener(), doesn't require a security check...

However, don't bother memorizing them as these methods will act just like any other display object to outside users, and won't affect your code at all.



Thanks to Senocular for pointing much of this out.

Error: Error #2069: The Loader class does not implement this method.

Error: Error #2069: The Loader class does not implement this method.
at Error$/throwError()
at flash.display::Loader/addChild()
at Main/onXMLComplete()[C:\Documents and Settings\Andreas\Desktop\temp\menu_8_sept\Main.as: 116]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
Following this error number leads to a simple line:
ActionScript Code:
var imgLoader:Loader = new Loader();
var preloader:Preloader = new Preloader(); //Just a little custom preloader class that says "Image Loading"
imgLoader.addChild(new Preloader()); //ERROR #2069



At first thought, this should be possible. Checking the language reference, the Loader class extends "DisplayObjectContainer", so it should indeed have that function.

In fact, all of the following functions will give an error message:
  • addChild()
  • addChildAt()
  • removeChild()
  • removeChildAt()
  • setChildIndex()


The answer is hidden away in small print inside of the Language Reference:
Quote:
The Loader class overrides the following methods that it inherits, because a Loader object can only have one child display object—the display object that it loads. Calling the following methods throws an exception: addChild(), addChildAt(), removeChild(), removeChildAt(), and setChildIndex(). To remove a loaded display object, you must remove the Loader object from its parent DisplayObjectContainer child array.
So, basically, because the Loader class can only ever contain one item, you are not allowed to run functions on the loader class that change how many items are inside of the loader.

As usual, the ActionScript 3.0 Language Reference is your best friend.

Thursday, August 13, 2009

TIP: Tweening Functions

I often get annoyed by the fact that most tweening engines do not allow the tweening of functions.

Here is how you work around that!

This example will be using TweenLite, but if anyone wants me to write similar code for other Tweening engines (such as GTween or Tweener), just ask.


Here I will be tweening the graphics.lineTo() function to draw a simple line from the top left corner of the stage down to the bottom right, straight through the center of the movie, but tweened!

The key is creating a new object, and then applying the needed properties of that object to the function you want to run.

ActionScript Code:
import gs.TweenLite;

//This sprite is what we will draw the lines on, insead of drawing them directly onto the stage.
var lineSprite:Sprite = new Sprite();
this.addChild(lineSprite);

//The key is to create a new object, and put tweenable properties on it
var drawObj:Object = new Object();
drawObj.targetObject = lineSprite;
drawObj.x = 0;
drawObj.y = 0;
drawObj.endX = this.stage.stageWidth;
drawObj.endY = this.stage.stageHeight;

TweenLite.to(drawObj, 5, { x:drawObj.endX, y:drawObj.endY,
onStart:startDraw, onStartParams:[drawObj],
onUpdate:updateDraw, onUpdateParams:[drawObj] } );

function startDraw(obj:Object):void
{
obj.targetObject.graphics.lineStyle(5, 0x000000);
obj.targetObject.graphics.moveTo(obj.x, obj.y);
}

function updateDraw(obj:Object):void
{
//Here is where all the action happens.
//This code is executed each and every time the tweening engine changes the value of x or y
//Here is where you place the function you want to tween, and use whatever parameters are needed
obj.targetObject.graphics.lineTo(obj.x, obj.y);
}



That code can also be abbreviated down a lot. This code is less clear to read, but will run faster. Also, instead of creating a new function that will call the function to be tweened, the lineTo() function will be called directly.
ActionScript Code:
import gs.TweenLite;

//This sprite is what we will draw the lines on, insead of drawing them directly onto the stage.
var lineSprite:Sprite = new Sprite();
this.addChild(lineSprite);

//The key is to create a new object, and put tweenable properties on it
var drawObj:Object = {targetObject:lineSprite, x:0, y:0, endX:this.stage.stageWidth, endY:this.stage.stageHeight};

//Prepare the sprite for drawing
//This code was originally in a startDraw function
drawObj.targetObject.graphics.lineStyle(5, 0x000000);
drawObj.targetObject.graphics.moveTo(obj.x, obj.y);

TweenLite.to(drawObj, 5, { x:drawObj.endX, y:drawObj.endY,
onUpdate:obj.targetObject.graphics.lineTo,
onUpdateParams:[drawObj.x, drawObj.y]

Tuesday, June 2, 2009

Flash 9+ for the Wii? [And more links + praise for FireFox]

FireFox, and its glorious offline tabs

Since I have a 45 minute commute to and from work (and luckily, I'm rarely the one driving), and at work I have no time to read up on blogs and sites, when I get to work and during my breaks, I find something interesting or try to find the solution to some problem that has been bugging me.

Then, instead of reading the post or blog (which usually ends up being pretty long and not worth spending my precious break time on) I open it in a tab in FireFox. Often, I'll notice an interesting title in the sidebar, which leads to another post, so I open it in another tab to read later. This process repeats several times during the day.

Finally, when I leave work, I have 40 different tabs containing all sorts of interesting information. The problem is, when I get home from work, I am to tired to stare at a screen, trying to comprehend with a blurry mind what some see as a clear solution to one of my problems. So the next day I go to work, still holding those 40 tabs, ready to be read. But during break, I accumulate even more!

So then you get to the point I am at now; 6 windows and 87 tabs (exactly, according to FireFox). And when you think you are all set to go, Windows XP decides to restart the computer and apply all those updates he thinks is so very important. [Tears hair from head, wanting to explode]

Thank goodness for the built in Session Restore feature. I don't know what I would do without FireFox, even though I believe that the programmers at Microsoft put in some sort of bug system that targets FireFox, hoping that internet users will switch over to the new and improved Internet Explorer [plays fanfare] .... not happening. FireFox is my friend, and I will never be unfaithful.

Enough about FireFox, on with the links!



Math.getProbability(Nintendo.Wii + Adobe.Flash));

I was Googling around, searching for any hope that Wii's built in browser might support might some day support Flash 9 or 10 (more specifically, AS3). That way, I wouldn't have to find an oldschool coder to convert my complex and likely sloppy code to slow, inefficient AS2.

I stumbled across this link, which brings a little hope to my heart, but sadly I can't verfiy the aucenticity of the information. I really hope so, but I wouldn't guarantee anything. It doesn't say anything about adding support for the browser, but it will allow Flash Developers to create games for WiiWare without having to learn a new language. :D

http://nintendo.joystiq.com/2009/03/13/cave-story-dev-nintendo-opens-wii-to-flash-development/

Now the big question is, will WiiWare development be open to anyone, or just people who pay an outrageous price for the WiiSDK and have a full fledged corporation where the proprietary information can be stored securely?

If anyone can verify this information with hard, cold evidence, please leave a comment or email me.



An important announcement from Developers woldwide:
Do you see the ads at the bottom of the page? Click them.

Most developers work for free, and the only money they earn is from advertisement income. It doesn't cost you a penny to click the link, and usually, you might find some pretty good deals or learn about a new neat site.

So give those developers a chance! Help keep free software... FREE!

CLICK THE ADS! (of other developers)

-- A message from your local department of coders.


So I encourage everyone, right now. Put down what you are doing. Stop thinking about how tired you are getting off this site. Next time you are on someone's site, show some appreciation, and click. Enjoy the great deals you find from clicking the ads, and deep inward satisfaction that you are putting food in my belly and getting me (legal people, read: others) through college. :)

Ads can actually be quite beneficial. For example, I recently clicked a link for an RTS game, and I'm actually enjoying it. (No, I won't give out the site address unless I get paid to advertise it)




More links to come once I get some sleep... Work tomorrow as well... Ugh...