28 February 2008

extended Flash XML tutorial

flash menus, buttons and components

I really like video Flash tutorials at gotoAndLearn.com by Lee Brimelow. One of them is XML basics where you can learn quickly (in 15 minutes) how you can create simple dynamic XML driven Flash image gallery. You will probably need another 15-30 minutes to understand XML class properties like firstChild, childNodes and attributes but that depends on your previous experience.

Let's extend this tutorial a little bit. What I needed was just a small variation on Lee's gallery. Previous and next buttons change images from 0 index to array length index. When end is reached button don't do anything. I wanted to change this so when I reach last image in the array click on next button will bring me first image in the array and also, when first image is displayed click on the previous button will bring me last image in the array.

We just need to change code a little bit. Within onRelease function for previous button, "if" gets "else", so code looks like this:

}else{
whoIsOn = urls.length-1;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoisOn];


Within onRelease function for next button, "if" also have some extra code:

else{
whoIsOn = 0;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];


That's it, everything else is the same. Adding new images and altering XML file won't harm this code.

.

19 February 2008

ActionScript basic drawing classes

Janis Radins has been playing around with creating some basic ActionScript drawing classes available over LGPL licence to download. All classes are subclasses from Base.as class which gives basic functionality. Available are Ellipse.as class, Polygon.as class, Rectangle.as class, TransformMatrix.as class and Triangle.as.

Here is my first creation,

ActionScript drawing sample

along with the source code.

import com.jR.Drawing.Ellipse;
var myEllipse:Ellipse = new Ellipse(_root, 1);
myEllipse.autoClear = false;
myEllipse.radius = 50;
myEllipse.drawOutline({drawX:150, drawY:60});
myEllipse.drawY += 15;
myEllipse.drawOutline({radiusY:35});
myEllipse.drawY += 20;
myEllipse.drawOutline({radiusY:15});
myEllipse.drawY += 20;
myEllipse.drawOutline({radiusY:35});
myEllipse.drawY += 15;
myEllipse.drawOutline({radiusY:50});
myEllipse.drawY -= 35;
myEllipse.drawX -= 35;
myEllipse.drawOutline({radiusY:50});
myEllipse.drawX += 70;
myEllipse.drawOutline({radiusY:50});

If you find this interesting you are welcome to send your link / code / sample via flanture [at] gmail [dt] com or leave comment about it.

13 February 2008

Don't get paranoid Mr. Frodo (!)

Sure, Flash widgets are cool, they make our blogs look inviting and special, but this doesn't mean they are 100% safe. There is an issue with Flash Player 9 update 3 (v9.0.115.0) and later when executing getURL or navigateToUrl. What is happening is that movie doesn't work if SWF is hosted in a different domain.

This can be easily solved if target name is set to "_blank" and this solution is safe and simple. However there is another solution that can be dangerous. That solution is to set HTML parameter AllowScriptAccess to "always". Side effect of this solution is allowing JavaScript to be executed through SWF file. If you are author of flash movie, no problem, but if you can't trust the widget's author, O-o!

Here is one example. Widespread Vizu web polls flash widget have allowScriptAcces set to "always". You can actually check this by yourself. Open your page source from your browser and search for keyword embed. Than check if allowScriptAcces parameter is present and what is its value. If it's "always", widget can be dangerous. Now, don't get paranoid (android), not all people are bad (Mr. Frodo).

More info about this issue, read this TechNote.



.

09 February 2008

Flash XML book - missing code

Few days ago I came across this book Flash XML Applications: Use AS2 and AS3 to Create Photo Galleries, Menus, and Databases in paper. The book was used, so I borrowed it but then I realized I'm short for CD. Ah, pity, but than again maybe one of my readers have code from this awesome book and if this is the case I would really like someone to send it to me via email or upload it somewhere on web.




Here is short contents:

Section 1 Introduction to XML Applications and ActionScript 2

Chapter 1 XML Introduction
Chapter 2 ActionScript 2 Revisited
Chapter 3 XML and XMLNode Classes
Chapter 4 Tutorial: Creating a Universal XML Load/onload Class
Chapter 5 Parsing XML with AS2
Chapter 6 Tutorial: Creating a Universal XHTML Parser
Chapter 7 XML Server-Side

Section 2 Components

Chapter 8 The Menu, MenuBar, and Tree Components
Chapter 9 The ComboBox Component
Chapter 10 Connector Components
Chapter 11 Creating an RSS Feed Reader

Section 3 Creating a Real Estate Web Site

Chapter 12 Creating Your Own Menu Bar
Chapter 13 Creating the Database (Part 1)
Chapter 14 Creating the Database (Part 2)
Chapter 15 Content Management

Section 4 ActionScript 3

Chapter 16 ActionScript 3: Basic Tutorial
Chapter 17 XMLDocument, XMLNode, XML, and XMLList Classes
Chapter 18 Menu Bar and ComboBox
Chapter 19 The Search Engine (Part 1)
Chapter 20 The Search Engine (Part 2)

.

04 February 2008

Flex introduction and misconceptions

James Ward wrote about top 10 Adobe Flex misconceptions. Here is a short list of those, complete arcticle at ultrashock.

1.Users need to install something new to run Flex applications
2. Flash Player is 100% proprietary
3. Flash is for designers, video, and annoyances
4. Flex is not for enterprise or business applications
5. Flex is expensive
6. Flex applications require a special server
7. Flex is hard to learn
8. With Flex, I will need to rebuild my entire application
9. Flex breaks normal browser functionality, like the Back button
10. I can do everything Flex does with Ajax





Another short but very useful introduction for total beginners in Flex from Sujit Reddy G.

_

 

template by blogger templates