Multimania Speaker

mxna

Archive for the 'AS 3' Category


cast String to LinkageId

Here in Belgium we have to build most of our flash projects in different languages, so most text is loaded from xml or databases. But sometimes its not possible to use dynamic text so we have different movieclips in our library displaying the same content but in an other language.

example: Home_nl, Home_fr, Home_en

It would be easy if we can create an actionscript function that will automatically display the right movieclip.
I found following solution:

function addHome(language:String):void{

var classLinkage:Class = flash.utils.getDefinitionByName(”home_”+language) as Class;
var home:MovieClip = new classLinkage() as MovieClip;
addChild(home) 

}

addHome(”nl”);

To use my example you need in your library a mc with linkage class name: home_nl

source

More mc’s using the same Actionscript Class

I had this post quiet long in draft but never found time to finish it. In the meanwhile one of my friends at multimediacollege just published a great explanation on the topic at their blog.

Designing a new Flash course

Last years i have been doing flash training with Adobe authorized training material, after the launch of CS3 Adobe decided to stop making new courseware. So for flash cs3 we tried some other course material but i was always missing the more global picture of creating flash projects, next to that i think that most as3.0 courses are to much focussing on building ria’s.

So i’m thinking about creating a course focussed on flash projects targeted for online marketing. I will be targeting flash developers and designer with a basic knowledge of actionscript.
Some basic ideas for an outline are:

  • checklist before starting
    • wireframes
    • source material: psd, ai’s, fonts
    • copy, translations
    • how to communicate with backend
  • tools
    • fla in flash
    • as in flexbuilder, flashdevelop or fdt
  • setting up
    • framework setup
    • multiple languages
    • server setup
    • backend setup
  • build a solid and flexible navigation system
  • building a reusable framework
  • working together: version control and best practises
  • lab exercise: working together as a team to create a small game

Feel free to make additions or remarks on this basic outline.

 

Wiimote GoogleMaps browser

Last months i have playing with the combination of wiimotes and flash. Biggest problem was connecting the wiimote with the pc or mac.

Last week i discovered a wiiflash server build for mac, this make stuff a lot easier. Connect your wiimote to your mac now take seconds.

In an hour or 2 i build this little google maps browser in flex controlled by a wiimote and using the wiiflash api (prerelease 0.4).

1151: A conflict exists with definition myMC in namespace internal.

Last months i’m doing a lot of actionscript 3 flash development, and because the flash ide is terrible for actionscript development i’m use the combination of flash (compiling fla) and flexbuilder 3. The annoying thing is that if you use the instance names of your mc’s, you get errors warnings in fb that he can’t find that clip. But if you re-declare the instance name in your as3 class you get errors in flash while compiling. The cause is off course that you re-declare an already existing variable

Last week i was talking with Peter Elst about this problem and he remembered something that you can do to disable the automatic declaration of instance names in flash. But at that moment we couldn’t find it in flash.

Tonight i got the same problem and started to search the world wide web for a solution. So to disable the auto declaration of instances go to the “publish settings” in flash -> Flash Tab -> Settings (next to Actionscript 3.0) -> uncheck “Automatically declare stage instances”. Just make sure you declare your mc in the as class as public.

Some AIR trouble

Last week we were building an AIR kiosk application. Everything went perfect until we installed the application at the client’s kiosk.

The basic idea of the kiosk is that you can record a video message. We used actionscript 3 connected to flash media server 2 to record the voice and audio. Around this we added some AIR to write the filename and some other details to a local sqllite database.

The problem occurred when we installed the AIR app on a windows computer (it was build on Mac). Sometimes the audio is recorded sometimes not. We weren’t able to figure out what was going wrong. After to much hours we removed the AIR wrapper and rewrote the app to use a local php, mysql server.

In the following week i will extract the problematic code and test it with the new fms3.

WiiMote + Flash part 2

Today i found some time to do some further testing with the WiiMote and flash. After the little trouble i had with MoteDaemon. We used MoteDaemon because we had trouble connected the WiiMote to Windows in the first place. So i today i went back to step 1 and start looking why the WiiMote didn’t connect the right way.

The problem seemed to be that BlueSoleil don’t support the Bluetooth driver of Bootcamp and the bluetooth dongle my collegue is using. So after some surfing i came around this article. After changing the ini files of BlueSoleil i used those ini files as driver for the bluetooth device. Now everything is working fine at last.

You have to use BlueSoleil because the bluetooth stack in windows doesn’t support the WiiMote.

Flash Media Server 2 and Actionscript 3 connection problem

When i was using my trusted fms connection code in actionscript 3 a got a strange error: “objectEncoding error”.

After a few minutes of research on google i found the following solution: “NetConnection.defaultObjectEncoding = ObjectEncoding.AMF0;”

The reason of the problem is that as3 uses amf3 by default, but fms 2 is still using amf0.

I didn’t had the chance to test it with fms3 (because the download site is down for the moment), but after looking through some blogposts it seems that fms3 will use amf3.

WiiMote + Flash

For a client we’re making a demo, where you can control a flash game by using the WiiMote.

My collegue Alwyn, already builded a wii controlled drum game at university which is perfect to show in a demo. The biggest problem we faced today was connecting the WiiMote to Windows. After a while i started looking for an OS X application. Quickly i came across DarwiinRemote and a little bit later a found the best solution for us.

MoteDaemon is a xml socket server, sending out the data coming from 1 or more WiiMotes. The downside at this moment is that we can’t use the nunchuck.

At the moment i’m making an actionscript 3 interface to connect to the socket server. When we finish the demo, we will put it online somewhere.

Edit: After some more research we noticed that MoteDaemon is giving wrong values back on the moment you connect more than 1 remote. It seems that the software is mixing the values of the connected remotes.

Tasklist for actionscript in Flexbuilder

It’s very posible that looking through the different views in Flexbuilder you noticed that there is something called tasklist. It’s a kind of todo manager for eclipse. The problem i had with this thing is that you had to right click on it and add a task manualy. Lazy as i am a started looking for a plugin that automatically extracts “todo items” out of my actionscript code and quiet quickly i found this plugin.

Next Page »