This blog has moved to a new location! http://iqandreas.github.com/

Friday, September 18, 2009

Wii Internet Channel with FlashLite 3.1 confirmed!

In my last post regarding Flash on the Wii, I was still looking for a reliable source to confirm that the new browser definitely had support for FlashLite, and it wasn't just a lousy rumor.

I was overjoyed to read the following message in my Wii Message board:

From Nintendo:
The Internet Channel, which allows everyone to easily access and enjoy the Internet, has been updated.

The main updates are as follows:
* Change from Adobe Flash version 7 to Adobe Flash Lite 3.1 (This corresponds to Adobe Flash version 8)
* The Internet Channel is now available to download for 0 Wii Points.

Press start at the bottom right of the screen and you will be able to download the updated Internet Channel from the Wii Shop Channel.

If you previously used 500 Wii Points to download the Internet Channel to your Wii console, at the end of October we will be offering you the opportunity to download, for 0 Wii Points, one NES game of your choice (valued at 500 Wii Points) from the Virtual Console catalog. Details of this download offer will be provided via the Wii Message Board or on Nintendo.com soon.

Nintendo




So, now all I have to do is decide which NES game I would like to download... Hmmm...

On a related note, I find it funny that Nintendo offers one NES game for up to 500 points instead of offering any software for 500 points or just putting 500 points onto your account. In an article I read recently, certain distributors (or something or the other) received rewards for putting offline Wii users online. After 10 rewards, they were granted full access to download and and all NES games they wished.

So why only NES games? My guess is that Virtual Console NES game sales aren't really doing that great compared to many of the WiiWare and newer Virtual Console games, so Nintendo is really pushing to make a greater profit and get those games distributed.

Of course, that's just my educated guess, and I could be wrong...


Time to start developing Wii Friendly games. :)

Thursday, September 17, 2009

Most common Flash Questions (AS3 FAQ)

When you help out beginners as much as possible each day, you tend to hear the same questions again and again (and again, and again).

Ignoring the fact that when I was little, I used to think FAQ was a bad word (not joking), I have here compiled a few links for threads with the most frequently asked questions in the Kirupa.com ActionScript 3.0 Forums.


TypeError: Error #1009: Cannot access a property or method of a null object reference.
Hands down, with no doubt possible in anyone's mind the absolute #1 error. There are 2 possible causes:


Duplicating a MovieClip (or at least creating a new version of whatever you pass in)
http://www.kirupa.com/forum/showpost...80&postcount=3
http://www.kirupa.com/forum/showthread.php?t=333120
http://www.kirupa.com/forum/showthread.php?t=334933 - Didn't realize the "constructor" property was so vulnerable. Nice discussion.


The difference between instance name and library name
http://www.kirupa.com/forum/showthread.php?t=333041


The Dictionary Class (Passing in custom variables to Events)
Personally, I really like using it since it allows you to pass in other variables to events such as telling which URLs go to which buttons, so you can use one function for the onClick event.
http://www.kirupa.com/forum/showthread.php?p=2484903
http://www.kirupa.com/forum/showthread.php?t=331118
http://www.kirupa.com/forum/showthread.php?p=2501990 - Some sample usage


Wow! How can I learn to be a great coder like you?
First of all, I'm good with Logic, but sadly I often use Flash instead, which is often similar, just uglier and meaner.
http://www.kirupa.com/forum/showpost...51&postcount=6 - Some great reading
http://www.kirupa.com/forum/showpost...85&postcount=2 - The Flash and PHP Bible


The advantage of using static properties and functions
I need to dig out an old MSN messenger discussion on this as well. It's on my rediculously long todo list.
http://www.kirupa.com/forum/showthread.php?t=334492


The strange way frames work in Flash
http://www.kirupa.com/forum/showthread.php?t=325891 - How frames really work. Might need some updating as this was posted early on when I was first learning Flash.
http://www.kirupa.com/forum/showthread.php?t=325884 - This guy still owes me a beer


There are plenty more, I just want to avoid digging through all 600+ of my forum posts for the gold nuggets. If anyone finds any more (by me, or anyone else for that matter) comment.

What's AS3 got that FlashLite doesn't?

I thought I was going to have to dig around for a while, perhaps comparing the language reference class for class until I found this, but it turns out Adobe already had the differences listed. (whew!)

Taken from:
http://livedocs.adobe.com/flashlite/3.0/docs/help.html?content=00005655.html


Unsupported Classes

  • Accessibility
  • Camera
  • ContextMenu
  • ContextMenuItem
  • CustomActions
  • LocalConnection
  • Locale (mx.lang.Locale)
  • Microphone
  • NetConnection (Available in FlashLite 3.0, but not FlashLite 2)
  • NetStream (Available in FlashLite 3.0, but not FlashLite 2)
  • PrintJob
  • TextField.StyleSheet
  • TextSnapshot
  • XMLUI

Unsupported Methods (Functions)
  • Mouse.hide, Mouse.show
  • MovieClip.attachAudio
  • MovieClip.getTextSnapshot
  • Selection.getBeginIndex, Selection.getCaretIndex, Selection.getEndIndex
  • System.setClipboard
  • System.showSettings
  • TextField.getFontList
  • Video.attachVideo (Available in FlashLite 3.0, but not FlashLite 2)
  • Video.clear

Unsupported Properties
  • Button.blendMode, Button.cacheAsBitmap, Button.filters, Button.menu, Button.useHandCursor
  • System.capabilities.language, System.capabilities.manufacturer, System.capabilities.pixelAspectRatio, System.capabilities.playerType, System.capabilities.screenColor, System.capabilities.screenDPI, System.capabilities.serverString
  • Key.isToggled
  • MovieClip.menu
  • MovieClip.useHandCursor
  • Stage.showMenu
  • System.exactSettings
  • TextField.menu, TextField.mouseWheelEnabled, TextField.restrict
  • Video._alpha, Video.deblocking, Video._height, Video.height, Video._name, Video._parent, Video._rotation, Video.smoothing, Video._visible, Video._width, Video.width, Video._x, Video._xmouse, Video._xscale, Video._y, Video._ymouse, Video._yscale

Unsupported Global Functions

  • asfunction
  • MMExecute
  • print, printAsBitmap, printAsBitmapNum, printNum,
  • updateAfterEvent

Unsupported Event Handlers
  • onUpdate
  • Mouse.onMouseWheel

Unsupported fscommands
  • allowscale
  • exec
  • fullscreen (I wonder if that means that FlashLite apps are unable to go fullscreen, or if you are just not able to set it to fullscreen via fscommand)
  • quit
  • showmenu
  • trapallkeys


Luckily, most of them are quite logical exclusions such as classes related to right clicking, using the cliboard, and accessing usb components such as the camera, microphone, or printer. The other methods and properties I rarely use anyway, so I could possible mark many as my custom classes as "FlashLite Safe". :)

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.