- Posted by kajyr on February 24th, 2009
- Tagged: adobe, flash, flex, tools, video
Finally Adobe has published a version of the beloved FLVPlayback that works either in Flash 10 and Flex 3. No more crappy NetStream in Flex! :-)
You have to login with your AdobeID and Agree to some blahblah ;-)
Download here the component - there are also documentation && examples.
Have fun
- Posted by kajyr on February 23rd, 2009
- Tagged: actionscript, quickreference
Just as a quick reference, since I usually forgot each time how to do it.
Assume to have a DisplayObject obj, you want to draw in a Bitmap a scaled snapshot of that object.
Just like when you are drawing thumbs.
- Posted by kajyr on February 20th, 2009
- Tagged: analytics, tips, wordpress
Being the stat nerd that I am, I love to track visit to this blog (and other websites) with Google Analytics.
Problem is that I’ve noticed that also my visits couts, i don’t want this, at least, if i’m logged as an administrator i open the blog pages lots of times, to check the comments, to edit the layout of the pages and so on.
Edit: Marco from goanalytics.info suggested a smarter way to do that. See comment #1. ;-)
So after some researches, i’ve found the solution: you can filter Analytics pageviews basing on IP or cookies. The first one is useful when you don’t want a renge of users in a lan, but since I’m a freelance and work from home (but also from my parent’s home, and sometimes i open the blog at a friend house) the IP solution doesn’t work.
Cookies.
The Idea is to modify the wordpress template, so that can insert a cookie if you are logged in as the administrator. Wordpress already sets up some cookies for you, but using these will filter out every wordpress user, we just want to filter out ourselves.
To find if the user is an administrator, a good tip come from the Mark on Wordpress blog, you have to check user capabilities.
Next, reading GA Help tells you how to filter results based on a user defined keyword, you need to add a js function to the body onload event (assuming you don’t have any other, if it is the case, just add after the ;
Mixing the two things, something like this should came out:
<?php if ( current_user_can('manage_options') ) {
$onload = "onLoad='javascript:pageTracker._setVar(\"custom_keyword\");'";
} ?>
<body <?php echo $onload; ?> ></body>
This should replace your body tag, so should go in the header.php (in my template, at least); remember to replace custom keyword with something unique, a md5 of something should work.
Notice that this javascript uses a function from google, so you have to include the GA js library in the head. But Analytics tells you to include the code at the bottom.. You can choose. It will work fine if you just paste the GA code in the head, or else you can split it (in that code, there are 2 <script> blocks, the first loads the .js from Google, the seconds tracks the visits), so that the first script block goes into the head, and the latter at the bottom of the page.
Next you have to setup a filter in GA. Easy easy, goto Analytics Setting (the firse page after the login), find the Filter Manager link, add a new filter,with these options
Filter Type: Custom filter > Exclude
Filter Field: User Defined
Filter Pattern:custom_keyword
Case Sensitive: No
Enjoy. ;-)
References:
Mark on Wordpress: How to check if a WordPress user is an “administrator”
Google Analytics Help: How do I exclude my internal traffic from reports?, How do i create a custom filter
- Posted by kajyr on February 19th, 2009
- Tagged: ant, asdoc, documentation, eclipse, Flexbuilder, tips
Has anyone tryed to document ActionScript code using asdoc? I for myself hate to input shell commands in Windoze. I used to be a unix – bash hacker (in another life), and i find particularly annoying the windows shell (don’t even talk about the one in Vista..).
So i said to my good old friend Google: how can i use ant (which can be used in eclipse) to generate documentation with some clicks?
The answer lies around and need a few hacks, I post here my version for the sake of clarity.
I won’t tell you how to install ANT in Eclipse / Flex Builder using the Software Update tool, this may offend you.
Instead i’ll tell you that once setup is done, you need to upen the Ant view and you need an xml named build.xml with some rules in it, that tells which program to run, in which folder to save the output and so on. The xml is pretty self explaining, but in case just drop a line.
<?xml version="1.0" encoding="UTF-8"?>
<project name="asdoc" default="main" basedir=".">
<property name="Flex.dir" location="C:\Program Files\Adobe\Flex Builder 3"/>
<property name="FlexSDK.dir" location="${Flex.dir}\sdks\3.2.0"/>
<property name="AsDocs.dir" location="${FlexSDK.dir}\bin\asdoc.exe"/>
<property name="AppClasses.dir" location="${basedir}\..\src"/>
<property name="Output.dir" location="${basedir}\out" />
<target name="main" depends="clean,compile" description="full build of asdocs"/>
<target name="clean">
<delete dir="${Output.dir}" failOnError="false" includeEmptyDirs="true"/>
<mkdir dir="${Output.dir}"/>
</target>
<target name="compile">
<exec executable="${AsDocs.dir}" failonerror="true">
<arg line='+configname=air'/>
<arg line='-doc-sources ${AppClasses.dir}'/>
<arg line='-window-title "My Application"'/>
<arg line='-output ${Output.dir}'/>
</exec>
</target>
</project>
Note that the paths are relative to the position of the build.xml file.
(Also, i didn’t build the xml from scratch, there are many version of the same file on many blogs, so if the one who wrote it shows up, it will be an honor to credit him)
- Posted by kajyr on February 19th, 2009
- Tagged: actionscript, math, websites
Since my particular relationship with math during all of my studies, one site about ActionScript programming I really do like following is FlashAndMath. There are a lot of good tutorial about non trivial problems, so fire up your (Google) Reader and start tracking this site.
I usually talk about problems and tricks i see during work hours, but I really should evolve and talk a little more about maths here. :-)
www.flashandmath.com
On a side note, if anyone has suggestions about things i may talk about, just drop a line.