I saw this on MySpace but have increasingly seen it more and more lately on numerous sites.
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: http://lads.myspace.com/upload/uploader.swf cannot load data from http://upload.myspace.com/ImageUpload/Services/Token/Token.ashx?&v=1.5&c=3C31853C-6021-9542-604F-A664AA8B1063.
at com.myspace.components::UploadFiles/getToken()
at com.myspace.components::UploadFiles/upload()
at com.myspace.components::UploadFiles/___UploadFiles_Panel1_show()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at mx.core::UIComponent/setVisible()
at mx.core::UIComponent/set visible()
at mx.containers::ViewStack/updateDisplayList()
at mx.core::UIComponent/validateDisplayList()
at mx.core::Container/validateDisplayList()
at mx.managers::LayoutManager/validateDisplayList()
at mx.managers::LayoutManager/doPhasedInstantiation()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callLaterDispatcher2()
at mx.core::UIComponent/callLaterDispatcher()
That is nothing but a crossdomain.xml security error. You'd think this would have been tested but oh well.
Instead of just pointing out someone's fault, my intent here is to show you how to keep your visitors from seeing this error.
Since this happened when trying to upload a new image they are probably using FileReference. So, here is what they should've done:
var ref:FileReference = ...
ref.addEventListener(SecurityErrorEvent.SECURITY_ERROR, handleError);
....
private function handleError(event:SecurityErrorEvent):void{
//playing catch
}
Another one that helps is IOErrorEvent.IO_ERROR. Those are the two you should always have when loading files or calling services even if you do just catch them and do nothing about it.
Hope this helps someone.
For the longest I've been writing code but I never packaged my common code into a library. Well, that comes to an end.
In the past few months I've been writing a media library for playing media (progressive and streaming) which is being implemented on a pretty large scale site right now. That is really the core of the library but I also have a RestrictedTextInput/TextArea component that basically changes the color of the text beyond the specified character limit. So, if the limit is 10 the 11th character+ will be red, for instance.
Anyways...you won't see anything in Google Code just yet but I will svn export from my internal svn soon and publish to Code.
http://code.google.com/p/somo-as/
Check'r out and I'll blog when I start posting code to it.
Name Background:
Cairngorm (Flex framework; also a mountain name) had mad pub' a few years back. I jokingly told my buddy Lukas I'm going to start a library named South Mountain (biggest mountain in Phoenix, I think) then I shorted it to SoMo. So...I stuck with SoMo. :-)
Just a quick tip here:
var username:String = File.userDirectory.name;
So far I know it works on Mac/Windows but I haven't tested Linux.
Hope it helps.
(subject says enough) :-)
This will be my 4th, or so, and my last as manager of Arizona Flash Platform Users Group. Nothing much to say here. Just looking forward to geeking out this year.
One of the easy things to do in Flash is tween but it never hurts to make an easy thing easier and that's exactly what Grant Skin...errr...my bad...gSkinner (hehe) has done. So, maybe it doesn't suit you, heck...might not suit me all the time, but I would say it is at least worth a look.
First off...go get it: http://gskinner.com/libraries/gtween/.
Second...read about it: http://www.gskinner.com/blog/archives/2008/08/gtween_a_new_tw.html.
Third...use it.
Wait...guess I do have to review this at some point so let's consider this the fourth bullet.
Things I like:
* 1 class file. No wondering what classes to use or where they are. It is literally only com.gskinner.motion.GTween. That's it.
* Easy tweening: new GTween(someObject, speed, {x: Math.random()*100});. That isn't a very useful tween but as you see it is pretty quick to tween.
* Easy tweening of multiple properties: new GTween(someObject, speed, {x: Math.random()*100, y: Math.random()*100, width: someObject.width*.5});. x, y, and width will all tween at once.
Things I LOVE:
* Chaining tweens:
var tween:GTween = new GTween(someObject, speed, {x: Math.random()*100});
var otherTween:GTween = new GTween(anotherObject, speed, {x: Math.random()*100});
tween.addChild(otherTween);
You can even set otherTween.delay and have the second tween wait a few seconds, or whatever, befor it begins.
* When fading an object you can set the autoHide tween property to true which will hide the object once the alpha is 0. That's a simple one but I hate leaving objects visible when alpha is 0 and it gets redundant to keep adding listeners on alpha tweens just to know when it is done.
* Events, events, events! It is completely event driven so you can monitor tween progress, completion, etc.
I could probably go on but I'd probably just repeat Grant's blog post.
Things I want to see:
* The first property expects an object. I'd like to see it accept an object OR an array of objects.
new GTween([someObject, anotherObject], speed, {x: Math.random()*100});
That would tween both of the objects to do the same thing. Right now I have to use two separate lines. It isn't a terrible thing but a simple fix.
Bugs:
I really haven't nailed down any bugs I've found but I also have only hit a couple snags. The only one I really noticed was with multiple objects tweening at once across different parents. Meaning, tweening objects in one MovieClip while simultaneously tweening other items. But...again...I never tracked it down so this could've been a bug in the rest of the code. If I find out the bug I noticed was a GTween bug...I'll be sure to blog any fixes I find.
For now, grab it and enjoy.
Ok...this isn't a "spoof" post or anything like that. AIR literally deleted everything on my desktop as well as screwed something up on my OS (Vista). How did this happen? I'm glad you asked.
First off...I didn't tell it to delete ANYTHING. I'm adding features to an app and one of the features is to save a file to a network share so I was testing it against my desktop directory. Since this is AIR I figured a simple file copy was sufficient.
Do you remember that old joke where someone sent you a spam email and opening the attachment showed your My Computer window deleting every file on your system? That's how I felt watching my desktop directory contents leave.
I'm on Windows...just right click on Recyle Bin and restore, right? NOPE. AIR DELETED ALL OF MY FILES PERMANENTLY!!!!! Every file...gone. I open Computer and and it tells me "C:\Users\John C. Bland II\Desktop refers to a location that is unavailable. ..." which is great because now I literally do not have a desktop (beyond a background image).
So, again...how did this happen? Ok...don't get testy. I had to vent through sidebars real quick.
//Copy JSON file to web server
var file:File = File.createTempFile();
var stream:FileStream = new FileStream();
stream.open(file, FileMode.WRITE);
stream.writeUTF("some content");
stream.close();
var jsonFile:File = new File(_filePath);
jsonFile.resolvePath("live" + _Index + ".json");
file.copyTo(jsonFile, true);
So, this all works up to the last line. Odd right? I don't have any delete lines. copyTo(...) is the culprit. Yep, copy really should be: copyAndDeleteAllContentsInTheDirectoryThenMoveFile(....). :-(
What's worse is the desktop directory is gone so I have NO idea if it even worked. Now I have to try it again. :-( This time I'm setting filePath to _File.desktopDirectory.nativePath+"/myapp" so it will only delete that directory vs everything.
copyTo(...)'s overwrite explanation:
"If false, the copy will fail if the file specified by the target parameter already exists. If true, the operation will first delete any existing file or directory of the same name (however, you cannot copy a file or folder to its original path). (Note: If you set this parameter to true and the source and destination File objects point to the same path, calling this method deletes the file or directory.) "
So...whatever it was...AIR DELETED MY DESKTOP! :-( Boo FLIPPIN' hoo! :-(
UPDATE:
The bug is in my resolvePath. It should be jsonFile = jsonFile.resolvePath("live" + _Index + ".json");. So, AIR tried to copy a file to a directory which caused the directory to get nixed since it was an overwrite. The time you want Vista's UAC to kick in...it is MIA! :-)
This is just a redirect to James' site. He has posted two videos which are both pretty good.
Last night I decided to not work but found myself on the computer. So while I was messing around I had the videos play in the background and he covered the very basic to the good stuff. I thought it was well done and organized.
Good work James.
(off-topic)
I thought about this quote earlier and found it funny...figured I'd blog it to add my copyright to it. :-D hehe.
"7 is the number of completion, unless your checking your voicemail...then it is the number of deletion."
:-)
My latest article published today on InsideRIA.com. It has been a long while but that was because I had personal issues delay my delivery of the article which pushed back the release date a few months.
Shortly after I submitted my final draft, Christophe came out with an app to show the offline sync abilities in 2.6. His app looks really nice and he has a custom Java assembler included in his source. My app uses the LCDS samples data so look to Christophe's for more on the Java side. Great app.
Anyways...read up and enjoy!

