Archive for the 'Flash' Category

08
Jul
11

FullScreen Flash mask gotcha

Long time between posts… but thought I’d document this so that anyone else coming across the issue can get a quicker fix than I found.

The problem I was having was with a masked area that wasn’t resizing along with the rest of the content when stage.displayState = StageDisplayState.FULL_SCREEN

The fix for this was to ensure that the mask was actually added to the stage before being applied to the DisplayObject you wanted to mask. Here’s some code:

var __mask:Shape = new Shape();
__mask.graphics.beginFill(0xffcc00, 1);
__mask.graphics.drawRect(GRAPH_X, GRAPH_Y - 40, GRAPH_WIDTH, GRAPH_HEIGHT+39);
__mask.graphics.endFill();
addChild(__mask);
_barsHolder.mask = __mask;

The fix wasn’t entirely obvious as masks don’t generally need to be added to the DisplayList to function properly. Obviously when you’re having the Flash go fullscreen you do.

Hopefully that helps someone else avoid the issue I was having.

13
Oct
10

Flash busted my bullocks last week

Generally speaking, Flash and cross browser deployment go hand in hand… not so for me over the last week. I spent 4 days doing some work for an Agency in London, and I encountered 3 browser related Flash “bugs”.

1. The stage appears to initialise quicker in Firefox and Chrome on Windows than it does in IE. I was working with some code that I hadn’t written (gotta throw a disclaimer in there ;-), and the assumption the code was making was that the stage dimensions were available on Frame 1 of the actionscript’s Document Class. IE wasn’t having a bar of this assumption, instead returning 0 for both the width and height, which was essentially causing the rest of the application to render off screen. Simple remedy was to add an ENTER_FRAME listener and wait for the dimensions to be greater than 0. Notch that one up to utilising someone else’s code that wasn’t really tested properly across browser… but that’s kinda the point of Flash right?

2. The MouseEvent.MOUSEWHEEL event doesn’t fire in IE 8. It does however work in IE6 and 7. I performed the obligatory Google searches for people that were experiencing the same issue, and only really managed to see results related to Mac and the scrollwheel (which can be remedied using swfmacmousewheel). Does anyone have the mouse scroll wheel working in IE8?

3. ExternalInterface relies on the swf actually being visible on screen in Firefox and Chrome. In IE, setting the div that contains the Flash content to display:none still allows a javascript function to communicate with the swf. In Firefox, when the div is hidden, the swf somehow ceases to exist. My hunch is that this is to with swfobject… This situation can be remedied by moving the swf off of the browsers viewport (ie. position:absolute; left:-1000; for a movie that’s 1000 pixels wide). Not sure of the ramifications this fix would have on CPU usage though (the new Flash Player 10.1 made changes in this area (see Periodic timer)).

20
Jun
10

A Flash spoof of Apple’s HTML5 page

This is absolute Gold!

http://www.flashlab.com/html5/

Bravo to those that created it; you’ve made some very salient points with the examples and comparisons given.

Now we just need to ensure that the same number of people (including Managers and tech decision makers) that read the dribble Apple’s CEO posted a few months back could see and experience this site. And hopefully they can if the Flash community band together with the aim of setting the facts straight.

16
Jun
10

FileReference.load() - keep it in scope!

Just a quick note (possibly to self) that when dealing with FileReference you need to ensure that the scope of the FileReference is maintained. This was mentioned in the Actionscript documentation, but it took me a while to figure out that that could be the problem for my code failing silently. Originally I thought it was because I wasn’t using the right playerglobal.swc from within Flex, or that I couldn’t export using Flex SDK 3.2 (as this method is a Flash Player 10 one). It took me a while to reread the documentation for the load method and comprehend that perhaps I needed to declare some instance variables instead of local ones. Some code will hopefully illustrate what I mean:

public function uploadImage():void
{
	var __imageTypes:FileFilter = new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png");
	var __fileRef:FileReference = new FileReference();
	try	{
		__fileRef.addEventListener(Event.SELECT, onFileSelect);
		__fileRef.addEventListener(Event.COMPLETE, onFileOpen);
		__fileRef.browse([__imageTypes]);
	} catch (error:Error) {
		trace("Unable to browse for files.");
	}
}

private function onFileSelect(event:Event):void
{
	trace("onFileSelect called");
	var fileRef:FileReference = event.target as FileReference;
	fileRef.load();
}

private function onFileOpen(event:Event):void
{
	trace("onFileOpen called");
	var fileRef:FileReference = event.target as FileReference;
	var data:ByteArray = fileRef.data as ByteArray;
	var encoder:Base64Encoder = new Base64Encoder();
	encoder.encodeBytes(data);
	trace(encoder.toString())
}

The problem with that code is that the original __fileRef variable is only available within the uploadImage function. As soon as onFileSelect is triggered (which works fine), fileRef (a new local variable within this function) trys to call load(). This was failing silently for me.

So instead of declaring the original __fileRef variable as a local one, I’ve declared it as a private variable in the class. That way it’s always in scope!

27
May
10

Flash 10.1 - Failure is not an option

In light of the recent debate sparked by Steve Jobs’ comments regarding Flash and it’s perceived weaknesses I thought I’d take an opportunity to make it patently clear - the perception of Flash is that it’s a slow, memory and cpu intensive, battery sucking sun of a gun!

Now while I found it relatively easy to pick apart what Jobs said in my previous post, there’s certainly a long way to go to convince the rest of the tech world that the things he’s saying are false. It seems that Adobe are putting a good percentage of their eggs in the Flash Player 10.1 basket as a sign to all those interested in the debate that they are trying to address all (or most) of the issues that have been raised. My fear is that if this release isn’t the golden hair child that Adobe’s making it out to be, then we’ve got a bit of a case of the boy crying wolf on our hands.

The more I read (and I’ve been keeping close tabs on what both sides are saying), the more I see the battle lines are being drawn based on a lot of misinformation. Or more succinctly, the naysayers are not aware of the work that’s been going into 10.1 - fair enough I suppose, you’re only as good as your last innings…

So it’s for this reason that the only thing that really matters is that this latest release gets beta tested to buggery, delivers on the feature-set and enhancements that are being touted, and the millions of other Flash developers out there continue to have a livelihood that doesn’t involve jumping through hoops that are wasteful, and frustrating.

I’m slightly miffed that it’s taken a massive kick in the pants by a competitor (though perhaps that’s always the way…) to open Adobe’s eyes to some of the more regularly complained about issues with Flash. The issues that are now trying to be addressed aren’t new, they’re issues that Flash Designers and Developers have been on Adobe’s case about for many years … so long as their eyes are now open (and remain so), well I suppose that’s a start.

I can’t remember a tech issue that’s gotten me this energised for years! So I’m looking forward to seeing what devices start to utilise the forth coming Flash Player, and how they (and there battery life) perform.

Failure is not an option.

30
Apr
10

“Everyone wins” - ya f#%king what?

Steve Jobs, in his recent enlightened rant regarding Flash said that as a result of barring Flash from all of their mobile devices the following would occur, “Everyone wins - we sell more devices because we have the best apps, developers reach a wider and wider audience and customer base, and users are continually delighted by the best and broadest selection of apps on any platform.”

Let me pull apart that sentence, and impart what Steve actually meant. Which is, “we (Apple) sell more devices”.

Surely the best apps in the world are created by developers that have been plying their trade for more than 10 years now. Why on Earth would you choose to isolate them from the development process if you were truly after the best applications.

Surely reaching the widest audience, actually involves reaching the widest audience - not some bizarro subset that Steve Jobs deems appropriate (users are smart enough to make their own decisions about what technology they should and shouldn’t use - making the choice for them is denigrating and anti-competitive). Apple will likely get what’s coming to them in a form of a law suit and a lot of bad press.

And surely users would be delighted to choose from millions of applications from the best and brightest creative minds on the planet, rather than only being able to choose applications built by developers suckling at the teet of Apple and it’s proprietary Mac hardware and software.

So be under no illusions folks, the only potential benefactor from Steve Jobs’ lunacy on this matter is Apple. Plain and simple.

And I for one will be having no bar of it.

As developers of the applications, we have the power to steer our own destiny. Sure Adobe need to pull there finger out on a few of the points Jobs has made in his post (reliability, security, performance, touch) but as far as I can tell the latest version of the player will attempt to address these issues. And boy oh boy if it does, Apple can kiss good bye to any lead it enjoys on the Apps store front and the i/phone/touch/pad front - ‘cos the Google Android express (which is truly an open platform) is coming through. The guile of the man to even hint at one of the issues with Flash being it’s proprietary nature, when everything that Apple does is controlled with an iron fist is (and I’m definitely not the first to use this phrase in regards to his post) the pot calling the kettle black. I’ve never really understood what that old saying actually means, so perhaps I’ll just say that they’re being pretty blood hypocritical and leave it at that.

So when Adobe team up with the other platforms (Google, Nokia, Sony Ericsson, et al), and forge ahead with a truly cross platform Flash player - Apple will be left wondering how it can have screwed the pooch so badly… for the second time in it’s history. The sooner this happens the better for me - the Apple’s been bad for a while now.

(Update: here’s a great video that has Adobe’s CEO Shantanu Narayen rather elegantly sticking to the company line, at the same time making Jobs look like he’s thrown all of his toys out of the pram).

09
Feb
10

My babies alive!

http://www.wrench.com.au/

Initially built using AS2 but never launched in 2006 (due to time constraints i.e. doing real work), the domain that was supposed to showcase my wares remained as a coming soon page for nigh on 4 years. Finally the bullet was bitten in the latter part of 2009 and the decision to port the entire site to AS3 and utilise the Gaia framework was made. Within 4 weeks, a fully functional, SEO compliant, user accessible site was finished and launched. Kudos to Steven for the framework, rock on Gaia!

Feel free to leave any comments you’ve got about the site; be they good, bad or otherwise…

Wrench screen grab

20
Oct
09

Loaded swf obscuring mouse events in overlapping movieclips

Long time no read. Been busy with a large Flex project, plus I’ve been trying to see a bit more of Europe - but thought it was about time to get back onto some blogging. That and I’ve come up against something that I can’t seem to figure out (and it doesn’t look like anyone else has either from the amount of Googling I’ve done looking for a solution).

Basically what I’m doing is loading an swf with an image in it, which loads over the top of another swf which has some navigation elements in it. What is occurring is the swf on top is preventing any mouseover events from reaching the buttons below the image. I’ve zipped up a test archive to try and illustrate what’s going on. If you run test2.swf, and then mouseover the part of the orange square that intersects the green square, the green squares mouseover event should fire. I’ve set mouseEnabled = false on the orange square, but the fact that it’s in a completely different swf seems to mean that this doesn’t have any effect. The part of green square underneath the orange square is simply not receiving any events.

I’m actually using the Gaia framework, so it’s doing all of the loading of the swf’s. And I thought possibly setting the ApplicationDomain of the swf’s to be the same would mean things would work - but it didn’t. So if anyone’s experienced overlapping assets in two different swf’s interfering with mouse events then please let me know in the comments below.

01
Jun
09

Flash Catalyst or Catastrophe?

I’ve been watching the large number of blog links regarding the news from Adobe labs that Flash Catalyst is now in public Beta; naturally I had to download and have a go myself.

My first impressions are not good.

It seems like they’ve decided to invent their own usability best practices for the tool shortcuts. Where the hell is the pan tool? Why doesn’t holding the space bar and then using the mouse to scroll perform a pan? Keyboard shortcuts for delete don’t seem to work in the layers panel. Where is the align panel? Do I really have to right click an asset and select an align option from a dropdown? It’s a real mouseathon in the program at the moment. These aren’t really things I see as Beta related, they should just be in the app - which they are in any other CS4 product, so I’m mystified how these issues got through QA to this stage.

Probably the biggest issue is the speed (or lack thereof) of the program. Trying to edit a button’s state is painfully slow. I’m not sure whether this is to do with my system (dual core 2.4Ghz with 4Gb RAM on Vista) but I’d like to know if I’m the only one who thinks the program runs painfully slowly.

Aside from the usability and productivity issues I’m still at a loss as to why the CS4 core wasn’t used for this (or was it?) and even why we need a further dilution of the Flash product base. Surely Flash CS could be re badged as Flash Designer and the Catalyst toolset integrated (I realise I made that sound easier than it would be, but as it stands the introduction of this third tool looks like more of a money grab than anything else). This would go nicely alongside the newly re badged Flash Builder (which incidentally looks very good, so kudos to the Flex team).

I haven’t upgraded to CS4 as yet, and it’s for some of the reasons above that I haven’t. I just don’t know where the Flash products are headed, and quite frankly if this is where they’re going I may jump ship completely onto HMS Flex and let the “designers” out there handle getting the assets I’m after into a state in which I can use them. Though the right side of my brain may have something to say about that statement…

15
Jan
09

as3 casting issue

Either I’m going slightly mad or casting using the “as” keyword works differently to the old way of casting.

Here’s some code to illustrate:

showFormItem = (((e.target as CheckBox).selected as String) == _local.displayTriggerValue[i]) ? true : false
Now this gives a different result to:
showFormItem = (String((e.target as CheckBox).selected) == _local.displayTriggerValue[i]) ? true : false

WTF?!

I’m pretty sure I’ve got my brackets in the correct spot.

Yhelp!




Categories

Recent Comments

Posts this month

February 2012
M T W T F S S
« Nov    
 12345
6789101112
13141516171819
20212223242526
272829  

Archives