RSS
 

Flash security

19 Nov

I'm currently preparing a seminar for my college course "Internet safety", and I'm writing about Flash security in various scenarios. It is practical work, so there will be a lot of free code to look at.

When I'm done with it, I'll be putting it in some small e-book for everyone to read.

Stay tune. :-)

 
No Comments

Posted in News

 

Trouble activating Flash?

19 Nov

Well, I reinstalled my Flash CS3, entered my serial number, but when it came to activating it, I couldn't. Probably because I'm in Croatia which isn't part of EU and definitely isn't in America. :-)

Anyway, solution is tied to proxies. The thing that worked for me was to set up proxy settings in my default browser (Mozilla Firefox).

On this site I found proxies which I could connect to. So I went to Tools -> Options -> Advanced -> Network tab -> Settings. Choose Manual proxy configuration, enter proxy address and port, and check Use this proxy server for all protocols. Now you can close windows and test if your connection is working. Try opening your home page or any page you want. Connection will probably be slower, but it should work. If it doesn't work you either didn't input proxy settings correctly or server you wish to connect to is offline.

So now your connection over proxy works. Now open Flash and try doing activation (normal activation, not over proxy).

P.S. You can check if server is online with opening cmd, and ping it. If it responses, your connection should work.

Hope it helps someone, because I lost all day on figuring out activation, and I hope none else will suffer anymore. :-)

 
No Comments

Posted in News

 

Version your development!

18 Sep

Why?

Everyone has probably heard about Subversion. It allows you to track your project (project versions) and manipulate those versions. When big project is involved, lots of companies put their code to version control. Why? Because it safeguards the code from falling apart when 2 or more developers are working on the same file (that is Subversions primary goal). But none of developers I know uses Subversion for developing small projects on local machine.

Couple of times I did some programming, and I added or changed something and my program just stopped working. Than I would click undo button like crazy but I lost my previous working version. But of course, every problem can be solved, and I solved it every time, but I lost a few hours doing so. Back then I would kill for Subversion.

Time to put in some action!

If you had similar problem or you want to have safer future, put your code under version control.

Necessary programs:
1. Apache (I use XAMPP)
2. Subversion
3. TortoiseSVN

I won't explain installation of those 3 components, it would be a waste of time, because there are already references on the internet.

You can follow installation process from TortoiseSVN user guide (Chapter 3. Setting up a server).

When you have a new project on your hand, you only have to add new repository, and your newly created folder for your project put under control with Import to that repository and then SVN Checkout. I recommend you also read Chapter 4 and 5 from guide to get you started.

I recommended TortoiseSVN because it is really simple to maintain your code rather than typing in command line.

Review steps...

1. Install Subversion, TortoiseSVN and XAMPP (or anything you'd like)
2. Adjust all three to work together (read user guide)
3. Create your initial repository and decide on the structure (also read guide)
4. Start versioning!

 

Mouse over faces of PV3D cube

30 Aug

Problem

When you try to interact with cube material to determine which face has mouse over it, it is impossible to do it with adding OBJECT_OVER listener to cube.

Solution

Basic thing is that instead of putting listener for mouse over, we listen to mouse move. Or if we put it in perspective of listeners in cube with which we are working, OBJECT_OVER listener is replaced with OBJECT_MOVE listener.

You will need one variable for holding current cube face on which mouse is over:

private var currentCubeFace:String = "";

Next, you'll need to add listener to your cube:

this.cube.addEventListener( InteractiveScene3DEvent.OBJECT_MOVE, cubeMoveHandler );

Finally in cubeMoveHandler you will need to check if face on which mouse is over has changed. That is neccessary so that event only occur once. That way we simulate OBJECT_OVER method but which works will cube faces. Here is cubeMoveHandler method:

private function cubeMoveHandler( event:InteractiveScene3DEvent ):void {
	//Check if mouse is over another cube face
	if ( this.currentCubeFace != ( event.target.name + "" + event.face3d.material.name ) ) {
		this.currentCubeFace = event.target.name + "" + event.face3d.material.name;
		this.textField.text = "Target: " + event.target.name + ", face: " + event.face3d.material.name;
	}
}

Get source files

 
 

New skills

27 Aug

Over this summer vacation I added new skills to my portfolio. Check it out! If any of it interests you, check my About page.

Papervision3D

papervision3d

Papervision3D is an open source 3D engine for the Flash platform. It is written and maintained by a small core team, and contributed to by its ever-growing community.

Core team
* Carlos Ulloa
* John Grden
* Ralph Hauwert
* Tim Knip

Contributors
* Patrick Pietens
* Ron Valstar

http://blog.papervision3d.org/

Adobe AIR

adobe_air

The new Adobe® AIR™ runtime lets developers build rich applications that deploy to the desktop. AIR applications run across operating systems and are easily delivered using a single installer file. With Adobe AIR, developers can use their existing skills in Flash to build highly engaging, visually rich applications that combine the power of local resources and data with the reach of the web.

Adobe AIR offers an exciting new way to engage customers with innovative, branded applications, without requiring changes to existing technology, people, or processes.

From shopping on eBay to managing music, Adobe AIR means applications that are easier, more powerful, and more fun to use.

http://www.adobe.com/products/air/

Flash components

Flash component is collection of ActionScript classes and Flash FLA file making one graphic component simple to use and reuse. It allows developers to simply drag&drop component to their project, add parameters and they are done with it. It also allows live preview of changing dimensions and changing skins to the component. The beauty is that component is reliable separated from rest of the project.

 
1 Comment

Posted in News

 

AntiAliasing dynamic TextField

26 Aug

Problem

Problem comes up when you dynamically add TextField with special font to your movie. You can create empty dynamic TextField on stage and embed fonts in it. Then you have global access to that font from TextFields through your classes. But by default you have No Bitmap antialiasing turned on. So your font looks distorted.

Solution

Assuming you embedded fonts which you will use, to fix this problem there is class AntiAliasType. TextField contains property antiAliasType which you will need to set.

var format:TextFormat = new TextFormat( "Calibri" );

textField.text = "Some text.";
textField.embedFonts = true;
textField.antiAliasType = AntiAliasType.ADVANCED;
textField.setTextFormat( format );

Don't forget importing:

import flash.text.AntiAliasType;
 
 

Basic XML checking…

18 Aug

Lots of unexpected errors can come from mistyping XML. So you have wrong data, and you load it to your program and of course it will work wrong.

You can be sure to check your loaded data before doing anything. Also be sure to cast your data when assigning it to variable. In example:

//Sample XML
var xml:XML = <node attribute="1">Node text</node>;
 
//Assign node text to txt variable
var txt:String = null;
if ( "node" in xml ) {
	txt = String( xml.node );
} else {
	trace( "Node doesn't exist!" );
}
 
//Assign node attribute to num variable
var num:uint = 0;
if ( "@attribute" in xml ) {
	num = uint( xml.@attribute );
} else {
	trace( "Attribute doesn't exist!" );
}
 

Second language: AS 3.0

05 Aug

This is not a standard post, but it's so awesome I had to put it up. Everyone should have a chance to learn to speak ActionScript, and Doug Winnie made sure you can do it.

So if you're new, enjoy it:
ActionScript 1:1 with Doug Winnie

 
No Comments

Posted in News

 

Enable stage object in loaded SWF

26 Jul

Suppose you load some SWF in your main SWF, and you want it to have access to main's stage. In Document Class of loaded SWF you should add:

public function LoadedSWFConstructo() {
  this.addEventListener( Event.ADDED_TO_STAGE, init );
}
 
public function init( event:Event ):void {
  trace( stage.quality );
}

So, in loaded SWF constructor you would register for ADDED_TO_STAGE event, and then you can use stage object. Simple enough.

Why do you need this? Mostly when having your application in full browser window. When resizing occurs you would want to resize or move objects in you loaded SWF. Imagination is the limit. :-)

 
 

Getting fresh data from database

25 Jul

2702418661_28a44ea538

Problem

Problem is that some browsers won't refresh data got from database. They cache query results. Example:

var url:String = "http://www.example.com/get_data.php";
var req:URLRequest = new URLRequest( url );
var loader:URLLoader = new URLLoader();
loader.load( req );

So with this you can load results from php document. But when you ask for results again, some browsers (I noticed IE) will cache results and you will get same results. Refreshing the page and loading your application again will help. But you don't want user to refresh page, don't you?

Solution

Solution is pretty simple. In order to get new result you must confuse browser. You can confuse it by giving it new url to load. So, on our original url we will give it some meaningless sufix which won't do anything other than generate new url.

url += "?randomVar=" + Math.random();

Your new url will look like this now:

http://www.example.com/get_data.php?randomVar=0.8319580480456352

This way on every refresh you get different number as sufix, making your url unique.

Finally your code should be:

var url:String = "http://www.example.com/get_data.php";
url += "?randomVar=" + Math.random();
var req:URLRequest = new URLRequest( url );
var loader:URLLoader = new URLLoader();
loader.load( req );
 
1 Comment

Posted in Tutorials