Archive for the 'Uncategorized' Category

Targeting movieclip from an AS3 class file - reply

Tuesday, January 15th, 2008

This is a reply to Brian Chau’s post here, but my comment didn’t go through too well, so I’ll repeat it here…

————————————-

As Tink says, it’s normally better to encapsulate the functionality of each class using events and public methods instead of exposing the internals.

For this simple example, you might rewrite it something like…

Test.as

package
{
 import flash.display.MovieClip;
 
 public class Test extends MovieClip
 {
  private var blackbox_mc:BlackBox;
	 
  public function Test()
  {
	blackbox_mc = new BlackBox();
	this.stage.addChild(blackbox_mc);
	var myTest:Control = new Control(this);
  }
  
  public function positionBlackBox(x=null,y=null) : void {
	blackbox_mc.x = (x==null)?blackbox_mc.x:x;
	blackbox_mc.y = (y==null)?blackbox_mc.y:y;
  }
 }
 
}

Control.as

package
{
	import flash.display.MovieClip;
 public class Control
 { 
  private var view:MovieClip;
  public function Control(mc:MovieClip)
  {
	view = mc;
    view.positionBlackBox(null,100);
  }
 }
}

..although to me this still feels a bit odd as the main class is the view, it kinda shows how to break the two. The controller only knows what to view controll and what public methods it’s allowed to call on the view, nothing of how the view works internally.

If you then want to use a design time created blackbox you can simply plop the mc on stage, call it blackbox_mc and delete the instantiation references from the view, e.g….

Test.as

package
{
 import flash.display.MovieClip;
 
 public class Test extends MovieClip
 {
	 
  public function Test()
  {
	var myTest:Control = new Control(this);
  }
  
  public function positionBlackBox(x=null,y=null) : void {
	blackbox_mc.x = (x==null)?blackbox_mc.x:x;
	blackbox_mc.y = (y==null)?blackbox_mc.y:y;
  }
 }
 
}

As the blackbox_mc is already on the views stage flash auto creates the reference, so you can just use blackbox_mc without creating it.

Hope that helps.

A

Suspiciously cheap Flash?

Friday, December 7th, 2007

Just spotted an add for this shop in my Gmail, they are selling CS3 Flash Pro and Photoshop for just £65 each…

http://www.software-direct.co.uk

Thats like 85% off the £575 RRP, seems too good to be true and the site looks a bit thrown together, but they are advertising on Google… anyone got any info…?

No More Sony For Me!

Tuesday, October 24th, 2006

Well that’s it, the final straw. Lik-Sang have been shut down by Sony, what a bunch of tossers (Sony that is!). I never even used them personally, but I know a lot of people that did, including (as pointed out by Lik-Sang’s announcement) a few that work or worked at Sony. How’s that for hypocrisy?

In the past year I’ve probably spent over £3k on Sony products, I sit here writing this on a Sony laptop with a Sony phone next to me and a Sony camera and PSP in my pocket. I’ve even got a brand new Sony w850i arriving in a day or two. But no more, fuck ‘em, if I can send the phone back I will, and from here on in I’ll be actively avoiding buying any Sony products. Ever.

For a long time Sony’s level of customer contempt has been pretty obvious, but this has tipped the boat into actually directly putting people out of business simply to make a few more dollars. Quite simply (if it’s not immediately obvious) Sony aren’t doing this for any customer relations reasons, they are doing this simply to prevent someone else making a fair and legal profit in a gap left by their stupidity, incompetence and greed. If you can’t beat ‘em, sue ‘em. Makes me sick, and they have just lost a customer. I invite you to join me.

Eh???

Thursday, June 1st, 2006

Quite an interesting interview with Sony’s ‘head game designer’ Phill Harrison , had to laugh at this though…

“When we launched Playstation in 1994 we introduced the concept of real-time computer-generated 3-D-graphics for the first time.”

You did, did ya….so what about games like 3d monster maze (1981), Elite (1984), Wolfenstein 3d (1992), etc… all 3d real time games, all out a long time before Sony ‘invented’ the genre.

Either Mr Harison has been badly missquoted, or he’s talking marketing nonsense :)

Bye-bye iTunes…

Tuesday, May 30th, 2006

…hello MediaMonkey!

At last I’ve found something to take over from ol’ iTunes, which has been noticably feeling the strain since my MP3 library passed the 10,000 tune mark. MediaMonkey seems to load & work quickly, it’s library management is light years ahead of iTunes, and best of all it’s amazingly easy to extend with simple VBScripting.

Expect a few MediaMonkey scripts in the near future, I’m currently working on one that emulates the ‘now playing’ tab of Amarok (which I also love, but it only runs on *nix), and after that I’m gonna try sticking some Flash in there (perhaps for a nice interactive ‘browse by album art’ type view)