Often in bug testing phase or just to show something it’s a tideus work to screendump your screen and it get as well a problem if you are dependent by the transparency.
Wrote a small debug class that takes a screen dump of the stage and puts the file on a server (PHP).
So put this PHP on a server somewhere.
<?php
$png = $GLOBALS["HTTP_RAW_POST_DATA"];
$name = date('Y-m-d H.i.s');
$filename = $name.'.png';
file_put_contents($filename, $png);
?>
<?php
$jpg = $GLOBALS["HTTP_RAW_POST_DATA"];
$name = date(‘Y-m-d H.i.s’);
$filename = $name.’.png’;
file_put_contents($filename, $jpg);
?>
<?php
$jpg = $GLOBALS["HTTP_RAW_POST_DATA"];
$name = date(‘Y-m-d H.i.s’);
$filename = $name.’.png’;
file_put_contents($filename, $jpg);
?>
Then you can add this class to you project, required is the adobe core package (http://code.google.com/p/as3corelib/).
Download Screendump.as
To use it first set the URI and stage
Screendump.stage = this.stage;
Screendump.URI = “http://localhost:8888/screendump/dump.php”;
After that whenever you need to take a dump, run
Screendump.takeDump();
Flash debug, Flash, screendump
For a couple of months ago I publish a post about fonts embed with unicode range. There are ways on how to extract the fonts from Flash files with some de-compiling but for those who found the article interesting but never figured out the unicodeRange bit, well there is a solution.
1.) First look on how to setup and use the FontManager
2.) Download UnicodeHexCreator I created to create the unicodeRange.
The AIR Unicode app is used to create the correct unicode range to optimize the amount of bytes that is needed to be loaded. To get the range it’s really simple.
1.) Copy/Paste your entire XML file to the input field (top field)
2.) Select font to use and set class name.
3.) Press convert
4.) Copy/Paste the unicodeRange to the Flex Project that creates the font file.
Download UnicodeHexCreator.
Flash, Flex dynamic, embed, font, runtime font, unicode
Just love Flex for building Flash 9, AIR and Flash 9 applications. But what about Flex 10 applications. As usual, new framework needs to be kicked in!
1.) Get the SDK
1.1.) Goto http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+3/
1.2.) Download latest “stable build” and choose the “Adobe Flex SDK”.
2.) Install the SDK
2.1.) Unzip and place the files under /Applications/Adobe Flex Builder 3/sdks/
2.2.) Open /Flex../sdks/flex_sdk_3.4.1.10084/frameworks/flex-config.xml
2.3.) change to, line 17; <target-player>10.0.0</target-player>
2.4.) change to, line 52-54;
<external-library-path>
<path-element>libs/player/10/playerglobal.swc</path-element>
</external-library-path>
2.5.) change to, lines 70-74;
<library-path>
<path-element>libs</path-element>
<path-element>libs/player/10</path-element>
<path-element>locale/{locale}</path-element>
</library-path>
3.) Setup Flex
3.1.) Open Window->Preferences->Flex->Installed Flex SDKs
3.2.) Add new SDK and choose the path that you copied to the Flex/sdks folder.
Lets create a Project and test it out.
4.1.) Create a new Flex Project.
4.2.) Right click on the project and choose Properties->Flex Compiler
4.3.) In the Flex SDK version, choose Use specific and Select the new SDK.
4.4.) To help the express install make sure to update the “require flash version”.
Now you are done to Rock n Roll !!!
Wanna try it? Test the 3D functionality.
<mx:Canvas backgroundColor=”#3FCEDF” width=”110″ height=”89″ x=”304″ y=”184″ rotationY=”30″ rotationX=”-30″ />
Flex flash player 10, flex 3
When sending data between Flash to Server I often use the AMFPHP service. It’s a easy to install and rapid way to send data back and forth. A problem I noticed when running a desktop application on PC was that it kept returning errors but from a MAC it worked just fine. The simple solution is to set the gateway to work as a test server, else the service blocks desktop calls.
Problem: Desktop application from PC getting errors in responses when MAC works fine.
Solution: Open gateway.php line: 106 and change PRODUCTION_SERVER to false.
Flash amfphp, desktop, error
Worked with Papervision 3D in a couple of project and trying to simulate the Maya 3D world to Papervision 3D as much as possible to make it easier for the art directors. A big problem has been with the Maya Camera and units. What we did is that the 3d modeler setups a camera in Maya and we are converting the values to the camera in actionscript to fit Papervision 3D.
What we are looking at is the FOV (focal length), the flash convert value is (xv / (2 * Math.tan(Math.PI * fov / 360))) /1.5;
Bojidar Dimitrov has an 1.5 lens converter that works excellent:
http://www.bdimitrov.de/kmp/technology/fov.html
By using the Maya Focal Length thru the converter and adding that to this formulas variable xv, you will get a Papervision 3D camera that is the same.
1
2
3
4
5
6
| // FOV from Maya
var fov:Number = 35;
// FOV to F from http://www.bdimitrov.de/kmp/technology/fov.html
var xv:Number = 45.741390734365076;
var focus:Number = (xv / (2 * Math.tan(Math.PI * fov / 360))) /1.5;
camera.focus = focus; |
Please visit Papervision 3D blog for great info.
Flash, Flex 3d, camera, maya, papervision
Working in a sound/voice heavy project right now, we keep updating the sound files in the FLA files all the time and they just keep crashing. When playing the sounds in Flash it gets a high pitch noise and is all scramble.
Solution:
Select the files in library and choose UPDATE, then Clear ASO Cache and export the file. Irritating bug I know but this seems to get my files to play correctly.
PS: Adobe Flash CS4 with WAV sounds.
Flash crash, cs4, export, noise, sound, wav
Working with a online webcam application and when trying my user-cases I noticed an irritating problem.
When connecting a webcam class to a Video the Privacy settings automaticly appear.
video.attachCamera( camera );
But if the user clicks DENY instead of ALLOW you can get into a little problem. My application needs a webcam so what I do is to show the user some copy and telling them to ALLOW the webcam or go somewhere else to play.
To check if the first time was allowed or not is easy with
camera.addEventListener(StatusEvent.STATUS, onCameraStatus);
but this is only triggered first time, event if I create a new Camera and Video class.
Solution
After the first event I set a variable that the user has already got the Privacy window. IF the user selects DENY and I want to give them another change (after my nice warning window) I do everything EXACTLY the same way, JUST ADD
Security.showSettings(SecurityPanel.PRIVACY);
If it’s the next try.
Flash deny, privacy, reconnect, StatusEvent, try again, webcam
Matching timings in Flash takes a while and lazy as I am adding StopWatch functions all over… well.
So I use this simple thing, click on the textfield to start counting, press again to get milliseconds copied to clipboard.
(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)
Flex match time to flash, millisecond, time
Wanted to post some Social media links on a site that I’m building but couldn’t find any good summary information, well, so here we go.

Facebook
http://www.facebook.com/sharer.php?u=’+encodeURIComponent(u)+’&t=’+encodeURIComponent(t)
u = url to site
t = title of link

Delicious
“http://delicious.com/save?url=”+u+”&title=”+t;
u = url to site
t = title of link
m = metadata for link

MySpace
“http://www.myspace.com/Modules/PostTo/Pages/?u=”+u+”&sa=2&t=”+t+”&c=”
u = url to site
t = title of link

Digg
“http://digg.com/submit?url=”+u+”&title=”+t+”&bodytext=”;
u = url to site
t = title of link

Twitter
“http://twitter.com/home/?status=”+t+” “+u
u = url to site
t = title of link

Stumbleupon
“http://stumbleupon.com/submit?url=”+u+”&title=”+t
u = url to site
t = title of link
Createad a simple js file to use for html pages or why not Flash applications. Send the types; facebook,delicious,myspace,digg,twitter or stumbleupon.
socialShare(type, link, title);
function socialShare(type,link,title,meta)
{
var shareURL;
var u = encodeURIComponent(link);
var t = encodeURIComponent(title);
var m = encodeURIComponent(meta);
if(!m) m = t;
var w = 626;
var h = 436;
switch(type)
{
case "facebook" :
shareURL = "http://www.facebook.com/sharer.php?u="+u+"&t="+t;
break;
case "delicious" :
shareURL = "http://delicious.com/save?url="+link+"&title="+title+"&q="+title+"&meta="+encodeURIComponent(m);
break;
case "myspace" :
shareURL = "http://www.myspace.com/Modules/PostTo/Pages/?u="+link+"&sa=2&t="+title+"&c=";
break;
case "digg" :
shareURL = "http://digg.com/submit?url="+link+"&title="+title+"&bodytext=";
w = 730;
h = 550;
break;
case "twitter" :
w = 760;
shareURL = "http://twitter.com/home/?status="+title+" "+link
break;
case "stumbleupon" :
shareURL = "http://stumbleupon.com/submit?url="+link+"&title="+title
break;
}
window.open(shareURL,"sharer","toolbar=0,status=0,scrollbars=yes,resizable=yes,width="+w+",height="+h);return false;
}
Download Social Share javascript.
Flash, Life link, network, social, social share
At my company “Hello There” we are currently developing a really cool game that is built on the base of Papervision 3D 2.0 (Great White). We suddenly run into a really really annoying problem.
I could publish the Flash files without any complication but the other two team members couldn’t, and we have the same set of workstations. After a lot of searching it seems somehow that it’s a memory problem and some suggestions points to changing JAVA memory, well, we didn’t get that to work either so we took another solution.
By making the Papervision package to a SWC file it’s already compiled and takes less memory for Flash. If you have a bigger framework you should as well take your time to create a SWC package for it. The publish time will decrease and your will be working happily ever after =)
TIP: Use more SWC, will speed up your work & use less memory.
If you have Flex, here is an easy tutorial on how to create your SWC package.
1.) Create a “Flex Library Project”.
2.) Add your code that you want to compile.
3.) Right click on the project, Properties->Flex Builder Path
4.) Mark all the packages that you want to compile
5.) Finish, just refresh the project to make sure everything is compiled when you change anything. The SWC file is placed in the /bin folder. Ready to use for Flex & Flash.
Did a really short video;
.
Flash, Flex compile, memory, productivity, swc