Jun 22
Bitmap draw and netstreams SecurityError
I was really struggling to find a fix for this whilst working on www.fortheloveofbeer.com.au so I thought I would post something here - to keep the transitions fast I had to take a bitmap of my screens (cacheAsBitmap just doesn’t seem to cut the mustard when you have a lot of text on stage) but I kept getting the following error;
SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: http://blah/main.swf cannot access unknown URL. No policy files granted access.
I tried every security fix I could think of but nothing helped. Trying to bitmap draw a screen with a custom video player component was causing the problem. If I tried to do the bitmap draw before an flv was loaded it would throw this error. Turns out that the NetStream object requires onCuePoint and onMetaData handlers to be defined or you will get this error. Why this should result in a security error I’ve no idea but if you come accross this problem yourself try the following and you should have a solution;
var clientObject:Object = new Object();
clientObject.onCuePoint = onCuePoint;
clientObject.onMetaData = onMetaData;
netStream = new NetStream(connection);
netStream.client = clientObject;
private function onCuePoint(e:Object):void {};
private function onMetaData(e:Object):void {};
If you get this problem yourself please leave me a comment letting me know… I couldn’t seem to find anything about this when I was looking for a solution.
2 commentsJun 15
My First SOTD!
Super stoked to announce my latest project for Holler Sydney has scored SOTD on FWA! Here it is in full technicolour;

Next site - hall of fame ![]()
May 14
It’s (A)live!
Finally launched the Samsung People site… have had to hold off posting until the client signed off. Checkout the transitioning background (perlin noise) and video flipping effect (image translation).
No, it’s not papervision.


You should definitely check out this guy

Apr 8
MouseEvent Bug
OK, I’ll try to word this as carefully as possible - as the bug may well be in my understanding of the Security model in flash.
I have a core as3 application that loads in external content, within the application I have some code that reads;
stage.addEventListener( MouseEvent.MOUSE_MOVE, move );
function move( e : MouseEvent ) { trace( e.target ) };
Which produces trace output wherever the mouse goes.
If I load an external SWF into the application and place it on stage - I lose the mouse move events unless the assets on stage has its mouseEnabled set to false. Fair enough you might say, but this only happens if the external assets are loaded from a different domain OR from a ‘../’ location when using the ‘file:’ protocol - if using http or loading a file locally the problem goes away.
This seems very odd, and has cost me a lot of time, is it something to do with the ‘root’ not changing if the asset isn’t the same domain? I’ve tried using Security.allowDomain in the asset file and no joy. Thoughts anyone?
Ian
3 commentsMar 11
use-network and file:// sandbox errors
By now most of us are familiar with the need to specify -use-network=false when building flex apps that require local file access. One additional little feature/bug that still causes security sandbox errors is the usage of absolute paths. So, to access the file file://path/to/file/assets.swf we must first set use-network=false as a compiler option and then also modify our path so that it’s relative, e.g. ../assets.swf (relative to the swf). If like me you access your access swfs by appending relative paths to the loaderURL you’ll need to check for an indexOf(”http://”) and set the root url to “” if it’s not present.
Best of all you only see the sandbox violation in debug mode, otherwise you get a file not found IO error. Fun.
Comments are off for this postFeb 27
Bitmap Mesh
I’ve been busy doing all kinds of fun stuff since starting my new role with these guys http://www.hollersydney.com.au/ - hence the lack of blog entries. I’m actually still pretty busy so this is going to be brief, below is a interactive bitmap distort - click on the corners and drag the image around. I have some outstanding issues when not dragging from a corner (dissipation of drag affect appears to be square rather than circular) but as soon as I’ve perfected it I’ll release the source.
I’d been keen for any input if anyone knows how best to calculate the lag from point to point so that the affect is circular (tried using radius from drag point but seems to cause other issues).
And before anybody asks yes the text is legible but the embed isn’t at 100%
1 commentJan 4
Stage Scale Mode and InteractiveScene3D
A very brief note for anybody working with InteractiveScenes in Papervision. The InteractiveSceneManager creates a duplicate displayObject in which to render the ‘interactive’ elements. The InteractiveSceneManager keeps its displayObject aligned with that of the original display object provided by calling resizeStage. If, like me, you decide to move your scenes canvas (the original displayObject used for the scene) then you must call resizeStage after making your change. Furthermore InteractiveSceneManager will maintain the canvas position itself by calling resizeStage, but this is dependent on the stage resize event and hence dependent on the stages scale mode.
I wonder - has anybody had much luck disabling the culling of polygons that cross the near-plane? I’m trying to wrap the camera in a container and polygons that cross behind the camera get culled - which although correct is not what I’m after.
3 commentsNov 14
Component life-cycle differs between MXML and code
If you read the livedocs text describing the component life-cycle for Flex 2 components the createChildren method is only ever called once (during the component creation phase). If you look at the adobe components in the sdk though, you find there is a lot of code indicating that the method can be executed more than once, e.g;
// Create the title bar over the top of the floating border.
if (!titleBar)
{
titleBar = new UIComponent();
titleBa...
}
Being the kind of person who would prefer to know ‘why’ rather than just go blindly ahead and do something I didn’t include any creation checks (as above) in my createChildren implementations, and up until now there it hasn’t caused any apparent problems. After instantiating one of my custom components in code though, via the new keyword rather than MXML it became apparent that createChildren is executed twice (after getting duplicate child items I stepped through with the debugger) - hence the creation checks should be implemented. Now, I don’t have an issue putting these checks in, but I’d really like to know how the life-cycle differs between the two methods of instantiation. I’ve had a brief look through the intermediate code (by using the –keep compiler flag) but there doesn’t seem to be any obvious difference.
So, does anybody out there know how the component life-cycle differs between pure AS3 and MXML??
After some helpful responses I decide to take a further look into the problem. It appears that the issue is not with how the component is instantiated but a side effect of adding the component to two containers in quick succession. I created a very simple example that causes createChildren to be executed twice;
var comp : Comp = new Comp();
this.addChild( comp );
otherLocation.addChild( comp );
When the component is added to the second container it still hasn’t reached ‘creationComplete’ which means it’s createChildren method is executed when adding the component to the ‘otherLocation’.
Ian
6 commentsNov 13
Fixing Flex 2 -> Flex 3 projects SDK (ctrl-click) navigation
Since I upgraded some of my Flex 2 projects to Flex builder 3 I haven’t been able to navigate to the SDK from within any of the projects. I couldn’t remember if this was how Flex Builder 2 worked as I haden’t done much development prior to the upgrade. A quick look on Google showed that the problem was already up on the Adobe bugs site, but without a solution… I decided to look through the config files for my upgraded project and compare them to a newly made FB3 project that was without issue. It turns out the changes required are fairly trivial.
To fix this issue in any of your projects close eclipse and make the following changes to the .actionScriptProperties file in the projects root folder;
- Remove the <modifiedEntries> tag.
- Remove any entries containing “../libs/framework.swc” or “../libs/flex.swc” from within the ’sourceAttachmentPath’ tag.
When you done, re-open the projects and you should find the ctrl-click navigation starts working again
Ian
No commentsOct 29
Design View in Linux Flex Builder (and a werborb p.s.)
If you want to see this happen then you MUST go to the following issues page https://bugs.adobe.com/jira/browse/FBE-207 and sign up/login to add your vote. If they don’t get a substantial number of votes then it won’t happen - so please, go do it now
P.S. I didn’t get much of a response to ‘Weborb and Flex - Part1′ so I haven’t done part 2 yet (a practical example) - if you would still find this useful then please just add a comment letting me now.
3 comments