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

Friday, April 10, 2009

Understanding the AS3 "1203 No default constructor found in base class %s. " Error

Gather 'round children, and I will describe to you the 1203 error in child friendly Layman's Terms.

"1203 No default constructor found in base class %s.
You must explicitly call the constructor of the base class with a super() statement if it has 1 or more required arguments."



When you extend a class in AS3, flash will automatically add a function that initializes the class that you are extending.

For example, let's say you have a "ship" class. When you create this class, you have a whole bunch of functions that create walls, shields, passenger compartments, motors, etc.

ActionScript Code:
public class Ship
{
public function Ship():void
{
//Here you will build the ship, and make sure it is functional.
this.buildHullAndWalls();
this.buildPassengerCompartments();
this.addElectronics();
this.addNavigation();
this.addMotors(new HyperDrive(), new SublightEngine());
this.addSheilds();

if (this.scanForDefects())
{
emailCaptain("Ship is in working order and ready to go! :) ");
}
else
{
emailCaptain("There is something wrong! There are problems with this ship still!");
throw new ShipBuildError("An error occured when building the ship. Please wait for repairs.");
}
}

}



Now, when you want to extend a class, it is like creating a new version of the parent class AND adding to it.

So to create a Cruiser (basically a basic ship with weapons), you could write all this out:
ActionScript Code:
public class Cruiser
{
public function Cruiser():void
{
//Here you will build the ship, and make sure it is functional.
this.buildHullAndWalls();
...
this.addSheilds();
this.addWeapons();

if (this.scanForDefects())
{
...
}
}

}


But doing this for each and every ship that extends the Ship is long, tedious, and memory consuming. Also, if you want to make any changes to the way the ship works (for example, adding the shields before you add the motors), you have to go back and change that code in every single ship that is built from a Ship, or extends the Ship.

So to have the Cruiser extend Ship:
ActionScript Code:
public class Cruiser extends Ship
{
public function Cruiser():void
{
this.addWeapons();
}
}



This simplifies making ships immensely, however, we have one (major) problem. Here, you are telling the crew to start adding weapons to the ship. That's fine and dandy, but where is the ship? You haven't told the crew to start building a ship yet! How are they supposed to add on the weapons?

Luckily, The Flash Compiler (known to his friends as "Foreman Flash") realizes this, so when you tell the crew to start building the ship, Flash looks through the list of tasks for the crew to do. He realizes that you are technically building a ship, and since the builders can't add anything to the ship until the ship is built, he adds a task for the builders at the start of the list. He tells them "First, build a standard ship, like the one you made for Larry last month. Then, add weapons to it, and make it a cruiser instead."

ActionScript Code:
public class Cruiser extends Ship
{
public function Cruiser():void
{
super(); //This means, do everything that the super class (or Ship) does to start out.
this.addWeapons(); //Now you can add weapons when you have a ship built!
}
}



That's OOP 101. However, sometimes things get a little more complicated than that. What if in order to build the standard Ship, the builders have to know how many passengers it will hold. Otherwise, they don't know if they should build a little or a small ship.
ActionScript Code:
public class Ship
{
public function Ship(howManyPassengers:Number):void
{
//Here you will build the ship, and make sure it is functional.
this.buildHullAndWalls();
this.buildPassengerCompartments(howManyPassengers);
this.addElectronics();
this.addNavigation();
this.addMotors(new HyperDrive(), new SublightEngine());
this.addSheilds();

if (this.scanForDefects())
{
...
}
}

}



Now we run into a problem. Foreman Flash has the task of building another Cruiser. As usual, he looks through the list to check if the ship can be built, so cruiser weapons can be added to it. Realizing that someone forgot that command, he again adds super() to the list, and the builders start working.

The builders start gathering supplies, when one person calls out "Wait a minute! How big is this ship supposed to be? Foreman Flash, we do not know how many passengers this thing will hold!"

Foreman flash looks at his clipboard again and again, but he has no idea of how big the client wanted the cruiser. He is now confused, and the builders are getting angry. Guessing a random numbe could be disasterous.

"1203 No default constructor found in base class! Help! I'm confused! No one ever told me what to do! I can't build without proper instructions!"

There is your error.


Next time, the ship buying millionare is smarter. When he orders a Cruiser, he says "I want the ship to hold 24,000 passengers. Get it done right this time."

ActionScript Code:
//This code is run elsewhere, perhaps on the main timeline
var NumberOfPassengersForMyCruiser:Number = 24000;
var MyPimpedOutCruiser:Cruiser = new Cruiser(NumberOfPassengersForMyCruiser);

//Here is the actual class located elsewhere.
public class Cruiser extends Ship
{
public function Cruiser(passengers:Number):void
{
super(passengers); //Now we add building the ship to the list so the Foreman doesn't have to worry about adding it himself.
this.addWeapons(); //Now you can add weapons, because the builders know how big the ship will be!
}
}



Another way of doing this, is perhaps there is a law in place which states that all cruisers must be built for 40,000 passengers. No more, no less.
ActionScript Code:
public class Cruiser extends Ship
{
public function Cruiser():void
{
super(40000); //Because the super() command just won't suffice!
this.addWeapons(); //Now you can add weapons, because the builders know how big the ship will be!
}
}



Or, if you are really smart, you could change the plans of the Ship design to say that, unless you hear anything differently, the ship will always be built for 30,000 passengers.

ActionScript Code:
public class Ship
{
public function Ship(howManyPassengers:Number = 30000):void
{
//Here you will build the ship, and make sure it is functional.
this.buildHullAndWalls();
this.buildPassengerCompartments(howManyPassengers);
this.addElectronics();
this.addNavigation();
this.addMotors(new HyperDrive(), new SublightEngine());
this.addSheilds();

if (this.scanForDefects())
{
...
}
}

}


Now the Cruiser class can look like this:
ActionScript Code:
public class Cruiser extends Ship
{
public function Cruiser(passengers:Number):void
{
//Don't bother adding the super() command here. The Foreman will do it automatically. That's what he's getting paid for. :)
//You can add it if you want to, but I say it is a waste of your time.
this.addWeapons();
}
}


When the Foreman looks through the list, he sees that you never told the workers start building the ship. "No problem, I'll just add the super() command here."

Then the builders receive their instructions. "First, build a ship, then add weapons to it. Wait! The foreman never told us how many passengers he want the ship to hold. Oh well, by default, they want 30,000 passengers, so we will just do what we usually do."

No errors. Everyone is happy.



Now. To go back to your code...
ActionScript Code:
package
{
import com.RadarPoint;
public class Rp1 extends RadarPoint
{
function Rp1():void
{
trace("YEAY! New RadarPoint child RP1 created!");
}
}
}


The Foreman looks through this code, and sees that you are building a RadarPoint, but you never told the workers to start building the RadarPoint! Proposterous! He quckly adds it to the list and send the workers on their way.

ActionScript Code:
import com.RadarPoint;
public class Rp1 extends RadarPoint
{
function Rp1():void
{
super(); //Added by the foreman.
trace("YEAY! New RadarPoint child RP1 created!");
}
}


So the workers look at the list, and start building a Radar Point. "Woah!! Big problem!! Foreman!!! We don't know what the values of newProp1:int, newProp2:Number, and newProp3:String are supposed to be!!"

ActionScript Code:
import flash.display.Sprite;
public class RadarPoint extends Sprite
{
function RadarPoint(newProp1:int, newProp2:Number, newProp3:String):void
{
this._prop1 = newProp1;
this._prop2 = newProp2;
this._prop3 = newProp3;
}
}



Next time, when the millinaire is ordering his brand new RP1, he remembers to tell the foreman and the builders what specifications he wants, avoiding any confusion:
ActionScript Code:
package
{
import com.RadarPoint;
public class Rp1 extends RadarPoint
{
function Rp1():void
{
super(3467, -345.37327, "Red/Blue");
trace("YEAY! New RadarPoint child RP1 created!");
}
}
}


Moral of the story, always tell Foreman Flash what to do, otherwise he gets mad and thows errors and swearwords in your way.



I should win a Pulizer.

Sunday, April 5, 2009

Blender 3D - Mobile Intel 965 Express Chipset Family Driver Problems

This post is mostly copied and pasted directly from my post in the blender.org forums.
http://www.blender.org/forum/viewtopic.php?t=14331

Problem
Whenever I try to type anything into a text field in Blender, it will not show up, neither the IBeam nor the new text. I can't even remove any old text. However, when I click outside (or deselect) the textfield, whatever I wrote in the textfield, any new values or any modifications, show up. The biggest problem is that you have no idea if you have made a typo until you deselect the textfield. This happens to every text field in the entire program, weather it's saving your project, or inputting a numerical amount.

My Hardware Specs
Although this should work for many other computers and blender releases, here are my hardware specifications:

Blender
Blender Version 2.48a
Python Version 2.5

Computer/Laptop
HP Compaq 2710p
Microsoft Windows XP - Tablet PC Edition 2005
Version 2002 - Service Pack 3
Intel(R) Core(TM)2 Duo CPU U7600 @ 1.20GHz
790 MHz, 2.99 GB of RAM (?? I thought I had 4 Gigs...)

Graphics Cards
Mobile Intel(R) 965 Express Chipset Family
Mobile Intel(R) 965 Express Chipset Family


Solution
No matter how I tried to install the driver, since I am running Windows XP Tablet Edition, it would not update to the new version. So I finally found a way around it.

Download the ZIP of the driver (not the EXE) from http://downloadcenter.intel.com/confirm.aspx?httpDown=http://downloadmirror.intel.com/17179/a08/win2k_xp1437.zip&agr=&ProductID=2800&DwnldId=17179&strOSs=&OSFullName=&lang=eng and unpack it to the desktop (or any temporary folder for that matter).

Go to Start and right click "My Computer", and choose "Properties".

Click "Hardware" and then the "Device Manager" button.

Click "Display Adapters" so it expands to reveal "Mobile Intel 965 Express Chipset Family". Right click that, and choose "Update Driver". That should reveal the "Hardware Update Wizzard" dialog.

Select the "Install from a list or specific location (Advanced)" radio button, and click next.

IMPORTANT: Then select "Do not search. I will select the driver to install." and click next.
Note that choosing "Search for the best driver in these locations" will not work. It will not recognize the new driver as better than the one you already have.


Click the "Have Disk" button, and then "Browse" in the dialog that appears.

Browse to the location to where you unpacked the new driver, and then open the "Graphics" folder. Double click on the file named "igxp32.inf", and then click "OK".

The driver "Mobile Intel 965 Express Chipset Family" should now appear in the list. Make sure it is selected, and then click next.

Wait while Windows copies over the new driver files. When it is finished, it should prompt you to restart the computer. Note that the new settings will not take effect until the computer is restarted, but this can be done at any time.


Hopefully this will make a difference for anyone out there. It did for me. :)

The 7 Wonders of the Flash World [The Best and Most Beautiful uses of Flash]

When browsing around online, you realize how rampant Flash is. Most of the time, you see the same old, same old, and each time you enter a new site, you pray "Please God, don't make this site have another slideshow made in Flash!"

Then there are those sites, often made for big Hollywood movies, that take 10 minutes to load, and all they do is let you see trailers and photos for the upcoming movie, and links to where you can download wallpapers cluttered with titles, logos, and release dates.

Cheap interactive advertisements on the side of pages, where you just can't help but click to speed up santa so he can outrun the elf, or shoot the ducks, seeing how many you can hit before you are forcibly redirected to some site that wants your credit card number in return for sending you "free" stuff.

Video sharing sites, where you can find anything from a guy waving a lightsaber around almost dislocating his shoulder to a ninja giving advice on life. Thousands of Terrabytes of video, filled with thousands of duplicates of other videos hosting TV shows, movies, and some crap someone made in 3 minutes with their webcam.

Game sharing sites, where you can waste hundreds of hours doing something that won't make anyone's life any better (or so they say. I disagree. The more you play, the more developers like me get paid!), most games only a clone of a classic or previously made game.

Finally, there are those sites filled to the brim with embedded with YouTube videos and Flash Games, often made by 13 year olds who have just found the glory of using templates and hosted websites.

Is there nothing original with Flash anymore in this world?


Now and then, I stumble upon a gem online, something original, so amazing that it cannot be described by words, but requires Flash to display it's pure beauty. Maybe it's the developer in me who sees these gems, amazed by how much time and effort must have been put in to making this possible, or perhaps the child in me, amazed by all the special effects and flashing lights.

Nonetheless, to free you out of the dark days where everything online made in Flash looks exactly the same, I bring you SWF files that stand out beyond the rest:



IKEA - Kitchens You Dream About
http://demo.fb.se/e/ikea/dreamkitchen/site/default.html
http://www.ikea.com/ms/en_CA/rooms_ideas/ckl/default.html
Countless hours rendering the output from your 3d modeling program have brought you what? A fantastic display of kitchens frozen in time where you can fly around from house to house looking at kitchens and activities therein. Beautiful.


Soy Tu Aire (I am your Air) - More than just music
http://soytuaire.labuat.com/
Despite being rediculously long to load (like all worthwhile flash apps are) this is a beautiful display of what would happen if you mixed a Japanese Paint program with Windows Media Player. I wish there was more music set up to play this way.


GE - Plug Into the Smart Grid - Argumented Reality
http://ge.ecomagination.com/smartgrid/#/augmented_reality
If you don't have a webcam, get one! This display is totally worth the 5 dollars you spend on a cheap camera. Also requires a printer. When you print out the sheet on the page, hold it up to the camera, and watch it come alive.
If you don't have a camera or a printer, at least watch the "See how it works" video, so you at least you know what you could have spent the last 5 minutes messing around with and thoroughly enjoying!



And then there was Salsa!  [Added Mar 5, 2010]
http://vimeo.com/9194146
Looks like an ordinary commercial? Prepare to be amazed...


Mercedes from A to S  [Added Mar 13, 2010]
http://www.a-to-s.co.uk/home.php
The ambient music (that's what it's called right? I have never been good with this 'new-agey lingo') sets a nice mood for these ninteneen different interactive slides which each bring out some little information about their suite of cars.
Many of the effects, although very neat, are actually quite simple. I might even write a small tutorial one day, taking one effect at a time and explaining how it was done.


The Scale of the Universe  [Added Mar 14, 2010]
http://primaxstudio.com/stuff/scale_of_universe.swf
You never realize what a tiny speck earth is in the middle of nowhere. This interactive display lets you zoom in and out of the known universe from the Strings of String Theory to the edge of the known and observable universe.
The images are mostly low quality and vector based, but they still get the point across, and if they hadn't been drawn in vector, you would likely need to wait 15 minutes for the entire presentation to load, so it works just the way it is and is still very well done.


The Eco Zoo  [Added Mar 26, 2010]
http://www.ecodazoo.com/
If you take a close look a the animals there, you might be able to get some tips to live in a more environmentally friendly way. 
A fantastic interactive 3d presentation. I'm not sure if they are using a publicly available library such as Papervision, or if they are using their own library, but whatever the case, it is very smooth and nice. One thing I didn't realize at first was that you can move around in the pop-up book scenes like you can in the main tower scene.
This is how story books are meant to come to life. Just add a story narrated by James Earl Jones, and make each character move around, and you have got yourself a story book that even the technology spoiled youth of today can enjoy.
(In my day, we had books made of paper, and the closest thing to interactivity was Barney. Now my 10 year old niece has her own phone, her own laptop, and several MP3 players)


FlashMoto's 10 top Flash Websites  [April 12, 2010]
http://www.flashmoto.com/blog/flash-news/the-most-fascinating-flash-websites-youve-ever-seen/
Similar to this blog entry, FlashMoto added posted a blog entry of the 10 most fascinating Flash websites they have come across. Instead of reposting them all here, check it out on their blog.



[Work in progress. Leave a comment if you find anything else that deserves a mention]

This is an Open Post, which means that the list will keep getting added to over time. Subscribe to the feed for this page to be notified of any updates.

Blogger Error bX-jn3okz when trying to reset your user name or password [English]

Even though I haven't posted here for a while, I still freaked out when I tried to login to my blog, but was unable to.

I had long gone forgotten my password as well as forgotten which email address I had used to sign up with Blogger, so I took the simplest method, and restored my password using my blog's name.

However, each time I tried typing in the name of my blog and hitting the "LOOKUP" button, I was met with the same error message:


We're sorry, but we were unable to complete your request.

When reporting this error to Blogger Support or on the Blogger Help Group, please:

  • Describe what you were doing when you got this error.
  • Provide the following error code and additional information.
bX-jn3okz

Additional information

host: www.blogger.com
uri: /forgot.do

This information will help us to track down your specific problem and fix it! We apologize for the inconvenience.

Find help

See if anyone else is having the same problem: Search the Blogger Help Group for bX-jn3okz
If you don't get any results for that search, you can start a new topic. Please make sure to mention bX-jn3okz in your message.


Clicking the link just led to 52 unresolved results of pepople having the same problem as me, with no support or help from the Blogger staff. No matter where I looked, I could not find any contact link or email address to Blogger.

I was frustrated! Why should I have to change my user name, just to mislead my 3 already faithful followers, and perhaps countless potential Google hits?

So I did what any other person would do; typed in my blog name and hit "LOOKUP" a hundred times, hoping that maybe the next click will work. Then I tried it in another browser. I even messaged a friend asking him to see if he was met with the same error message.

Finally, I scanned through every email account, trying to see if I had any old emails from Blogger that might contain my username and password. Finally, when loggin into my Yahoo, I had received 40 emails from "Blogger Support" named "Blogger Account Information".

To my joy and happiness, even though I thought the error message meant that I was unable to log in or reset my password, Blogger had still sent my email address out. Then it was as simple as clicking the link in the email to reset my password.


Moral of the story: write down your passwords, or use something simple like your pet's name instead of some random jumble of letters, numbers, and characters like I do. ;)

Additional moral of the story: Ignore the bX-jn3okz error if you are trying to reset your blog password. It will work anyway.