|| .Navigation
Download Adobe Flash cs4 full version
10 Oct 08Software[D]Adobe Flash CS4 10.0 Professional Final + Crack in Windows - Other889.02 MB00
09 Oct 08Software2 comments[D]Adobe Flash CS4 v10.0 Professional.incl.Crack_Full.version(working) in Windows - Other888.95 MB04
07 Oct 08Software2 comments[D]Flash CS4 v10.0 cracked .dll with keycode. in Windows - Other10.42 KB00

|| .Navigation

Friday 4 September 2009

Download the best Who's IP script it's very small for your website and forum






حمل أفضل أخف اسكربت كامل لمعرفة اي بي الزوار للمواقع والمنتديات
Download the best smallest script to show your visitors them IP

http://datafiles.agilityhoster.com/whois.rar




أفضل أخف اسكربت لمعرفة اي بي الزوار who's ip full script






حمل أفضل أخف اسكربت كامل لمعرفة اي بي الزوار للمواقع والمنتديات
Download the best smallest script to show your visitors them IP

http://datafiles.agilityhoster.com/whois.rar




Friday 28 August 2009

Adobe Flash Player 10 crossdomain.xml fle must be exist to work your flash for aspx dot net and all sites

Flash Player 10 meta-policy requirement for all sites and also ASPX and dot net .net sites which don't allow php proxy files
Adobe Flash Player 10 crossdomain.xml fle must be exist to work your flash for aspx dot net and all other sites


First of all you must put the crossdomain.xml file in the root directory of your site
for example www.mydomain.com/crossdomain.xml

you can see example in Adobe real file here http://www.adobe.com/crossdomain.xml
and also in youtube http://youtube.com/crossdomain.xml

second
if you want to give permission to only your site to load data from any where
you have to make your crossdomoain.xml file like below and upload it in the root directory: as we mentioned earlier www.mydomain.com/crossdomain.xml



<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*.mydomain.com" />
</cross-domain-policy>




but if you want to give permission to any site to load data from any where
you have to make your crossdomoain.xml file like below and upload it in the root directory: as we mentioned earlier www.mydomain.com/crossdomain.xml

<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" />
</cross-domain-policy>


that's all if you want to know more about this you can read below
Issue

Tomaintain the best possible security for end-users and servers, if a master policy file is not in the master location, does not contain meta-policies, or is set to master-only, other policy files defined in alternate locations on the domain will be ignored by Flash Player 10 and higher.
Reason

Flash Player 10 changes the default behavior of the meta-policy. A meta-policy provides server administrators theflexibility to designate what policy files arepermitted on a server. With Flash Player 10, the meta-policy default changed from "all" to "master-only." This change will allow any policy file saved in the root of the domain to continue to function as expected. However, all other policy files defined in alternate locations on the domain will require an explicit meta-policy.
Solution

Define a meta-policy for your domain. If you are only using a master policy file, Adobe still recommends that you define a meta-policy.

You can also manage policy files on a directory basis by setting up a master policy file that only sets a meta-policy. This can allow other policy files to be used without the master policy file declaring any specific permissions itself.

For example, if you control all the content on your server, and you areconfident that unauthorized userscould notcreate a policy file on your server, you can use the meta-policy all,permitting any file on the server to be used as a policy file:

<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
</cross-domain-policy>

If you want to prevent unauthorizedusers from creating a policy file on your server, you can use the meta-policy by-content-type,permitting any file on the server with the content-type text/x-cross-domain-policy to be used as a policy file:

<cross-domain-policy>
<site-control permitted-cross-domain-policies="by-content-type"/>
</cross-domain-policy>

You can also declarea meta-policy using HTTP response headers. For more information see the meta-policies section in "Policy file changes in Flash Player."

Thursday 27 August 2009

how to : Lightbox2

Overview

Lightbox is a simple, unobtrusive script used to overlay images on the current page. It's a snap to setup and works on all modern browsers.

What's New in Version 2

  • Image Sets: group related images and navigate through them with ease
  • Visual Effects: fancy pants transitions
  • Backwards Compatibility: yes!

Example

Single Images

Image Set

Plants: image 1 0f 4 thumb
Plants: image 2 0f 4 thumb
Plants: image 3 0f 4 thumb
Plants: image 4 0f 4 thumb

How to Use

Part 1 - Setup

  1. Lightbox 2 uses the Prototype Framework and Scriptaculous Effects Library. You will need to include these three Javascript files in your header (in this order).



  2. Include the Lightbox CSS file (or append your active stylesheet with the Lightbox styles).

  3. Check the CSS and make sure the referenced prev.gif and next.gif files are in the right location. Also, make sure the loading.gif and close.gif files as referenced near the top of the lightbox.js file are in the right location.

Part 2 - Activate

  1. Add a rel="lightbox" attribute to any link tag to activate the lightbox. For example:
    image #1
    Optional: Use the title attribute if you want to show a caption.
  2. If you have a set of related images that you would like to group, follow step one but additionally include a group name between square brackets in the rel attribute. For example:
    image #1
    image #2
    image #3
    No limits to the number of image sets per page or how many images are allowed in each set. Go nuts!

Download

Changelog

  • v2.04 - 3/9/08
    • NEW - Upgraded Prototype from v1.4 to v1.6.0.2
    • NEW - Moved label text into configuration for easier localization
    • UPDATED - Code cleaned up. Respect for the global namespace and native javascript objects.
    • FIXED - Caption displays as "null" when viewing an uncaptioned image after viewing a captioned image.
    • FIXED - Clicking 'close' button shifts layout as link focus' dotted line appears.
  • v2.03.3 - 5/21/07 - Support for horizontally scrolling pages. Added updateImageList method for ajax'y pages.
  • v2.03.2 - 4/30/07 - Fixed animated gif support in IE/Opera.
  • v2.03.1 - 4/18/07 - Fixed embed hiding. Overlay opacity var added to config. Image sets w/Imagemaps fix. Clearfix removed.
  • v2.03 - 4/10/07 - Improved keyboard navigation. Animation off toggle. Hides Flash movies under overlay. Imagemap support. Valid CSS.
  • v2.02 - Fixed layout issues caused by multiline captions. Added keyboard navigation.
  • v2.01 - Centering in IE6 (any DOCTYPE) fixed. Smoothed out resize transition.

Support

It doesn't work at all. The image opens up in a new page. What's wrong?
This is commonly caused by a conflict between scripts. Check your body tag and look for an onload attribute. Example:

A quick fix to this problem is to append the initLightbox() to the onload attribute as so:

It doesn't work if I click an image link before the page has finished loading.
The script is activated only after the page has finished loading.
The shadow overlay doesn't stretch to cover full browser window.
Remove the default margin and padding from the body tag. Add body{ margin: 0; padding: 0; } to your stylesheet.
Can I insert links in the caption?
Yes, but you need to convert quotes and greater and less than symbols into their html entity equivalents. For example:
Image
Can I display flash, video, or other content using the script?
Sorry, photos only. For other content, google for Lightbox modifications or try an alternative script such as Cody Lindley's ThickBox.
Can the script be called from an iframe?
If you're using iframes, try the Lytebox modification which has better support.
Can I use the script in a commercial project?
Yes. It is licensed under the Creative Commons Attribution 2.5 License. A donation would be nice, hint hint.

As for proper attribution, all that is required is that you leave my name and link atop the lightbox javascript file. I do appreciate an html link, but it is not required.

Tuesday 25 August 2009

Adding Lightbox to Flash

Adding Lightbox to Flash

Follow these steps to add Lightbox functionality to Flash files:

Step 1. First, download Lightbox++

Step 2. Copy the css, images and js folders from the archive in the same folder with your HTML file on your web server. This HTML file should embed the SWF file to which you want to add the Lightbox to.

Step 3. Edit the HTML file and add these lines in the section:

  1. <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
  2. <script src="js/prototype.js" type="text/javascript"script>
  3. <script src="js/scriptaculous.js?load=effects" type="text/javascript"script>
  4. <script src="js/lightbox++.js" type="text/javascript"script>


Step 4 (option A). If you want to have a Lightbox Image Set (with Next and Previous buttons), right after the lines from Step 3 add these lines, otherwise go to Step 4 (option B)

  1. <script type="text/javascript">
  2. function GroupDelegate(id) {
  3. var objLink = document.getElementById(id);
  4. Lightbox.prototype.start(objLink);
  5. }
  6. script>

In the body of your HTML file you’ll have to add invisible links to the images which will be displayed in the Lightbox, like this:

  1. <a id="img1" title="First image" rel="lightbox[img]" href="images/01.jpg"a>
  2. <a id="img2" title="Second image" rel="lightbox[img]" href="images/02.jpg"a>

Step 4 (option B). If you intend to have a single image display in Lightbox (as opposed to option A with Image set) you simply have to add these lines into the section of the HTML file:

  1. <script type="text/javascript">
  2. function LightboxDelegate(url,caption) {
  3. var objLink = document.createElement('a');
  4. objLink.setAttribute('href',url);
  5. objLink.setAttribute('rel','lightbox');
  6. objLink.setAttribute('title',caption);
  7. Lightbox.prototype.start(objLink);
  8. }
  9. script>


Step 5 (option A). If you’re using SWFObject to embed the SWF, make sure you’re having these two params (in addition to maybe other params):

  1. params.wmode = "transparent";
  2. params.allowscriptaccess = "samedomain";

Step 5 (option B). If you’re using tags to embed the SWF file, add these lines:

  1. <param name="allowscriptaccess" value="samedomain">
  2. <param name="wmode" value="transparent">

And in the embed tag you must insert the attribute:

  1. wmode="transparent"

Step 6. If the links to go to when clicking an image are specified through the XML file, the url attribute must be set like this:
1. For Step 4 (option A):

  1. url="javascript:GroupDelegate('img1')"

2. For Step 4 (option B):

  1. url="javascript:LightboxDelegate('images/01.jpg','First Image')"

Note that the Lightbox will not work if tested locally. You’ll have to test it on a HTTP server.

An working example of Lightbox implemented in the way described above you will see in the “index-with-lightbox.html” file from these two archives: dockmenu.zip and carousel.zip files

Execute Lightbox Scripts From Flash: Part Deux

Since the first thread showing you how to execute Lightbox scripts from Flash was such a big hit, I decided to write another showing you how to gain even more functionality in this regard. Tonight I will be showing you how to initiate a Lightbox containing a Flash movie from a Flash movie, and how to initiate Lightbox groups containing images as well as Flash movies. All of the following scripts can be used in the same page if you wish, you just need to include all of the following delegates into your project.

Initiating a Flash Lightbox from Flash

If you followed the previous thread, this should be a pretty straight forward process. All that really needs to be done is a few edits to your LightboxDelegate, and your getURL functions.

Example

Usage

The following code should be placed within your head tags, or linked via an external javascript file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
"text/javascript">
function SWFDelegate(url,width,height,caption) {
var objLink = document.createElement('a');
objLink.setAttribute('href',url);
objLink.setAttribute('rel','lightbox');
objLink.setAttribute('title',caption);
if(typeof width != 'undefined') {
objLink.setAttribute('width',width);
}
if(typeof height != 'undefined') {
objLink.setAttribute('height',height);
}
Lightbox.prototype.start(objLink);
}

If you’ve used the following bit of script before, you’ll notice a few changes. Since Lightbox++ requires you specify the width and the height of the Flash movie in your URLs, we’ve added the width and height arguments to our script. Now all that is left to do, is change our getURL functions around a little bit. They should now look something like the following:

1
getURL("javascript:SWFDelegate('images/sbemail.swf','550','400','Strongbad: Coloring');");

You’re now specifying the width and the height in your getURL functions, to match the signature of our javascript method. Remember, you must specify the arguments in the correct order: URL, width, height, and caption.

Initiating a Lightbox Image Group via Flash

I received quite a few e-mails and comments in regards to how this might be done. I did a little tinkering to get it to work properly, and if you follow along it shouldn’t be that difficult for you.

Example

Usage

The following code should be placed within your head tags, or linked via an external javascript file:

1
2
3
4
5
6
"text/javascript">
function GroupDelegate(id) {
var objLink = document.getElementById(id);
Lightbox.prototype.start(objLink);
}

The first thing you’re going to need to do is create links in your document just like you’re used to. The only difference is you’re going to be specifying an Id attribute in your links, which I will explain a bit more in a minute. The links in my document, that pertain to the above example look like this:

1
2
3


These links go right into your document that has your Flash movie in it. You’ll notice we don’t have any text between our link tags, which keeps our links from showing up in the page. The Id attribute can be named anything you wish, but you’ll need to remember them because they’re important for our getURL function calls in the next step. In my Flash example movie, my getURL calls look like the following:

1
2
3
getURL("javascript:GroupDelegate('paper1')");
getURL("javascript:GroupDelegate('paper2')");
getURL("javascript:GroupDelegate('paper3')");

So when the images are clicked in my example movie above, they call our GroupDelegate function that we defined earlier, and specify the Id of the image we wish to display in our Lightbox first, even though they will be in a group. So to break it down, if the blue image is clicked in my example movie, a getURL function is fired, calling the GroupDelegate function specifying ‘paper1′ as the argument. This argument is the same as the Id attribute in my link that pertains to my blue wallpaper.

Initiating a Lightbox Flash Group via Flash

This is pretty much the same setup as calling image groups from Flash with a few small changes. There is also a gotcha involved with using this method, which I will outline now. I suggest only using this method if the visitor is only supposed to watch the movies that are contained within a group and not interact with them. When in group mode, the Lightbox script’s previous and next links have a z-index that is greater than that of the Flash movies, which keeps the links above the movies, thus not allowing the visitor to interact with your movies. If you want to have the visitor interact with your video, I suggest using the first example in this post which is only a single Flash movie and doesn’t use the previous and next links. If someone has a solution for this, I’m all ears.

Example

Usage

The following code should be placed within your head tags, or linked via an external javascript file:

1
2
3
4
5
6
"text/javascript">
function GroupDelegate(id) {
var objLink = document.getElementById(id);
Lightbox.prototype.start(objLink);
}

The first thing you’re going to need to do is create links in your document just like you’re used to. The only difference is you’re going to be specifying an Id attribute in your links, which I will explain a bit more in a minute. The links in my document, that pertain to the above example look like this:

1
2
3


These links go right into your document that has your Flash movie in it. You’ll notice we don’t have any text between our link tags, which keeps our links from showing up in the page. The difference from the previous example is that we’re now adding width and height attributes to our links as Lightbox++ requires them. The Id attribute can be named anything you wish, but you’ll need to remember them because they’re important for our getURL function calls in the next step. In my Flash example movie, my getURL calls look like the following:

1
2
3
getURL("javascript:GroupDelegate('comics')");
getURL("javascript:GroupDelegate('lookingold')");
getURL("javascript:GroupDelegate('roadtrip')");

So when the button is clicked in my example movie above, it calls our GroupDelegate function that we defined earlier, and specifies the Id of the Flash movie we wish to display in our Lightbox first, even though they will be in a group. So to break it down, if the button is clicked in my example movie, a getURL function is fired, calling the GroupDelegate function specifying ‘comics’ as the argument. This argument is the same as the Id attribute in my link that pertains to my Strongbad Comic Flash movie.

Initiating Lightbox Scripts From Your Favorite Slideshows

A few of you requested information from my old post showing you how to initiate Lightbox scripts from your slideshow movies–namely SlideShowPro and Monoslideshow. I’m currently working on a post that breaks this entire process down for you, but until then you can check out my old examples. If you’re seasoned in messing with these delegates, you should be able to view source of the examples and pull out the proper delegates and implement them into your projects.

Download Example

Download the example to this tutorial here - Download Example

create a basic drawing application in flash

Create a Basic Drawing Application in Flash

In this tutorial, we'll create a Drawing Application with basic functions and an easy to use interface. Feeling artistic? Then let's go..

PG

Author: Carlos Yanez

Carlos is a Web/Logo Designer, Flash Developer with passion for great designs and cool applications.

Step 1: Overview

This application will feature a series of tools such as pencil, eraser, text tool, and also the possibility to save your drawing in png format using the Adobe's PNG Encoder.

Step 2: Setting Up

Open Flash and create a new Flash File (ActionScript 3).

Set the stage size to 600x350px and the frame rate to 25fps.

””

Step 3: Board

Draw a 600x290px white rectangle and convert it to MovieClip. Set its instance name to "board" and align it to the top-left of the stage.

This will be the area on which we'll be able to draw.

Step 4: Tools Panel

Create a 600px wide 60px high gray (#DFDFDF) rectangle and align it to the bottom of the stage. This will be our background for the Tools Panel.

Step 5: Tool Icons

I'm not going to cover the creation of the tools icons since that isn't the intention of the turorial, still, you can see how they are made in the Fla file included in the Source.

As you can see in the image, we're going to use two icons, one in a gray tone and the other one in color.

Convert the gray pencil icon to a Button (F8) and name it "pencilTool", double click to edit it and add a KeyFrame (F6) in the "over" state. Here's where we're going to put the color version of the icon.

Lastly, add another KeyFrame in the "hit" state, and draw a 30x30px square to act as the button's hit area.

Repeat this process with all your tool icons, don't forget to give them the correct instance names (eraserTool, textTool, saveButton, clearTool).

In order to display the active tool icon, we're going to use the color version of the icon and place it in the same position of the button we created before. The instance names will be "pencil", "eraser" and "text".

We'll hide these icons later using ActionScript.

Step 5: Save Dialog

When we use the save option we're going to display a "save successful" message.

Create a 600x350px black rectangle with 50% alpha to use as a background.

Add a black rounded rectangle in the center with the save button icon and some text indicating that the save has been completed.

Create a close button and align it in the top-left of the rounded rectangle, name it "closeBtn". As you can imagine, this button will close the Save Dialog.

Convert all the elements to a single MovieClip and mark the "Export for ActionScript" checkbox. Set the Class textfield to "SaveDialog".

We'll instantiate this class when the user presses the SaveButton and the save is completed.

Step 6: Size Panel

The Size Panel is the area where you can change the size of the pencil, eraser and text tool. You can do that by clicking in the panel area or the oval inside it.

Select the Rectangle Primitive Tool, set the corner radius to 4 and create a #EFEFEF 80x50px rectangle. Convert it to a MovieClip and name it "sizePanel".

Open the Filters panel and add a Drop Shadow with the following values:

Now use the Oval Tool to create a 5x5px black circle and center it in the Size Panel, convert it to MovieClip and set its instance name to "shapeSize".

Step 7: Default Colors

We'll create a default color palette instead of using the Color Picker Component.

Create a 22x22px circle using the Oval Tool, set its color to #EEEEEE and convert it to MovieClip. Add the same Drop Shadow Filter we used in the Size Panel.

Draw a second circle of 16x16px and use black for the color this time. Center the circles and repeat this process changing the last circle color to the following:

Align them to end up with something like this:

Convert all the colors to a single MovieClip, name it "colors" and be sure to set the Registration Point to the Top-Left, since we're going to get pixel data using the Bitmap Class.

Step 8: Adobe PNG Encoder

In order to use the Save function we'll need the Adobe PNG Encoder wich is part of the as3corelib that you can find in Google Code.

To use this class outside of the package it comes with as default, we need to change one line. Open the PNGEncoder.as file and change the line "package com.adobe..." to just "package". This will let us call the class in the directory where the Fla file is.

Step 9: Main Class

A single Class will handle this application. Open the Properties Panel in the Fla file and set the Document Class as "Main".

Create a new ActionScript Document and save it as "Main.as" in the same directory where the Fla file is.

Step 10: Import Required Classes

These are the classes we're going to need in this app. Remember to check the Flash Help (F1) if you're unsure of a specific class.

  1. package
  2. {
  3. import PNGEncoder;
  4. import flash.display.MovieClip;
  5. import flash.display.Shape;
  6. import flash.display.DisplayObject;
  7. import flash.text.TextField;
  8. import flash.text.TextFormat;
  9. import flash.text.TextFieldType;
  10. import flash.text.TextFieldAutoSize;
  11. import flash.display.BitmapData;
  12. import flash.geom.ColorTransform;
  13. import flash.events.MouseEvent;
  14. import flash.events.Event;
  15. import flash.utils.ByteArray;
  16. import flash.net.FileReference;

Step 11: Extending the Class

We're extending the MovieClip class since we use this class' specific properties and methods.

  1. public class Main extends MovieClip
  2. {

Step 12: Variables

These are the variables we'll use. They're all explained in the code comments.

  1. /* Pencil Tool shape, everything drawn with this tool and the eraser tool is stored inside board.pencilDraw */
  2. var pencilDraw:Shape = new Shape();
  3. /* Text format */
  4. var textformat:TextFormat = new TextFormat();
  5. /* Colors */
  6. var colorsBmd:BitmapData; //We'll use this Bitmap Data to get the pixel RGB Value when clicked
  7. var pixelValue:uint;
  8. var activeColor:uint = 0x000000; //This is the current color in use, displayed by the shapeSize MC
  9. /* Save dialog instance */
  10. var saveDialog:SaveDialog;
  11. /* Active var, to check which tool is active */
  12. var active:String;
  13. /* Shape size color */
  14. var ct:ColorTransform = new ColorTransform();

Step 13: Main Function

The main function will take care of setting the Text Format of the Text Tool, converting the Colors MovieClip to Bitmap Data so we can extract the Pixels RGB Value, adding the listeners and hiding the active icons.

  1. public function Main():void
  2. {
  3. textformat.font = "Quicksand Bold Regular"; // You can use any font you like
  4. textformat.bold = true;
  5. textformat.size = 16;
  6. /* We create these functions later */
  7. convertToBMD();
  8. addListeners();
  9. /* Hide tools highlights */
  10. pencil.visible = false;
  11. hideTools(eraser, txt);
  12. }

Step 14: Tools Actions

The tools actions are each split into four functions.

The first one will set the tool to its Active state, the second and third ones will handle the Mouse Events (like Drawing or Erasing) and the fourth one will stop those Events.

Step 15: Pencil Tool

These functions handle the Pencil Tool, read the comments in the code for a better understanding.

The set to active function:

  1. private function PencilTool(e:MouseEvent):void
  2. {
  3. /* Quit active tool */
  4. quitActiveTool(); //This function will be created later
  5. /* Set to Active */
  6. active = "Pencil"; //Sets the active variable to "Pencil"
  7. /* Adds the listeners to the board MovieClip, to draw just in it */
  8. board.addEventListener(MouseEvent.MOUSE_DOWN, startPencilTool);
  9. board.addEventListener(MouseEvent.MOUSE_UP, stopPencilTool);
  10. /* Highlight, sets the Pencil Tool Icon to the color version, and hides any other tool */
  11. highlightTool(pencil);
  12. hideTools(eraser, txt);
  13. /* Sets the active color variable based on the Color Transform value and uses that color for the shapeSize MovieClip */
  14. ct.color = activeColor;
  15. shapeSize.transform.colorTransform = ct;
  16. }

The Start function; this function is called when the Board MovieClip is pressed.

  1. private function startPencilTool(e:MouseEvent):void
  2. {
  3. pencilDraw = new Shape(); //We add a new shape to draw always in top (in case of text, or eraser drawings)
  4. board.addChild(pencilDraw); //Add that shape to the board MovieClip
  5. pencilDraw.graphics.moveTo(mouseX, mouseY); //Moves the Drawing Position to the Mouse Position
  6. pencilDraw.graphics.lineStyle(shapeSize.width, activeColor);//Sets the line thickness to the ShapeSize MovieClip size and sets its color to the current active color
  7. board.addEventListener(MouseEvent.MOUSE_MOVE, drawPencilTool); //Adds a listener to the next function
  8. }

The Draw function; called when the user presses the Board MovieClip and moves the mouse.

  1. private function drawPencilTool(e:MouseEvent):void
  2. {
  3. pencilDraw.graphics.lineTo(mouseX, mouseY); //Draws a line from the current Mouse position to the moved Mouse position
  4. }

Stop function, executed when the user releases the mouse.

  1. private function stopPencilTool(e:MouseEvent):void
  2. {
  3. board.removeEventListener(MouseEvent.MOUSE_MOVE, drawPencilTool); //Stops the drawing
  4. }

Step 16: Eraser Tool

The Eraser Tool is pretty much the same as the Pencil Tool, except that we don't use any color other than White.

  1. private function EraserTool(e:MouseEvent):void
  2. {
  3. /* Quit active tool */
  4. quitActiveTool();
  5. /* Set to Active */
  6. active = "Eraser";
  7. /* Listeners */
  8. board.addEventListener(MouseEvent.MOUSE_DOWN, startEraserTool);
  9. board.addEventListener(MouseEvent.MOUSE_UP, stopEraserTool);
  10. /* Highlight */
  11. highlightTool(eraser);
  12. hideTools(pencil, txt);
  13. /* Use White Color */
  14. ct.color = 0x000000;
  15. shapeSize.transform.colorTransform = ct;
  16. }
  17. private function startEraserTool(e:MouseEvent):void
  18. {
  19. pencilDraw = new Shape();
  20. board.addChild(pencilDraw);
  21. pencilDraw.graphics.moveTo(mouseX, mouseY);
  22. pencilDraw.graphics.lineStyle(shapeSize.width, 0xFFFFFF); //White Color
  23. board.addEventListener(MouseEvent.MOUSE_MOVE, drawEraserTool);
  24. }
  25. private function drawEraserTool(e:MouseEvent):void
  26. {
  27. pencilDraw.graphics.lineTo(mouseX, mouseY);
  28. }
  29. function stopEraserTool(e:MouseEvent):void
  30. {
  31. board.removeEventListener(MouseEvent.MOUSE_MOVE, drawEraserTool);
  32. }

As you can see, the code is the same except for the White color changes.

Step 17: Text Tool

The Text Tool has only two functions; one in charge of setting it to active, and the other one for handling the text writing. Let's take a look:

  1. private function TextTool(e:MouseEvent):void
  2. {
  3. /* Quit active tool */
  4. quitActiveTool();
  5. /* Set to Active */
  6. active = "Text";
  7. /* Listener */
  8. board.addEventListener(MouseEvent.MOUSE_UP, writeText);
  9. /* Highlight */
  10. highlightTool(txt);
  11. hideTools(pencil, eraser);
  12. }
  13. private function writeText(e:MouseEvent):void
  14. {
  15. /* Create a new TextField Object, this way we won't replace older instances */
  16. var textfield = new TextField();
  17. /* Set Formats, position, and focus */
  18. textfield.type = TextFieldType.INPUT;
  19. textfield.autoSize = TextFieldAutoSize.LEFT;
  20. textfield.defaultTextFormat = textformat;
  21. textfield.textColor = activeColor;
  22. textfield.x = mouseX;
  23. textfield.y = mouseY;
  24. stage.focus = textfield;
  25. /* Add text to Board */
  26. board.addChild(textfield);
  27. }

This one was easy, remember that you can change the size and color using the shapeSize and the Colors MovieClips.

Step 18: Save Option

The save option handled by the saveButton will make use of the Adobe's PNGEnconder Class to save the artwork as a PNG file.

  1. private function export():void
  2. {
  3. var bmd:BitmapData = new BitmapData(600, 290);//Creates a new BitmapData with the board size
  4. bmd.draw(board);//Draws the board MovieClip into a BitmapImage in the BitmapData
  5. var ba:ByteArray = PNGEncoder.encode(bmd); //Creates a ByteArray of the BitmapData, encoded as PNG
  6. var file:FileReference = new FileReference(); // Instantiates a new File Reference Object to handle the save
  7. file.addEventListener(Event.COMPLETE, saveSuccessful); //Adds a new listener to listen when the save is complete
  8. file.save(ba, "MyDrawing.png"); //Saves the ByteArray as a PNG
  9. }
  10. private function saveSuccessful(e:Event):void
  11. {
  12. saveDialog = new SaveDialog();// Instantiates a new SaveDialog Class
  13. addChild(saveDialog); //Adds the SaveDialog MovieClip to the Stage
  14. saveDialog.closeBtn.addEventListener(MouseEvent.MOUSE_UP, closeSaveDialog);//Adds a listener to the close button of the dialog
  15. }
  16. private function closeSaveDialog(e:MouseEvent):void
  17. {
  18. removeChild(saveDialog); //Removes the dialog of the Stage
  19. }
  20. private function save(e:MouseEvent):void
  21. {
  22. export(); //Calls the export function to begin the saving process
  23. }

Step 19: Clear Tool

The Clear Tool will add a white screen in front of all the elements in order to leave the board ready to draw again.

  1. private function clearBoard(e:MouseEvent):void
  2. {
  3. /* Create a white rectangle on top of everything */
  4. var blank:Shape = new Shape();
  5. blank.graphics.beginFill(0xFFFFFF);
  6. blank.graphics.drawRect(0, 0, board.width, board.height);
  7. blank.graphics.endFill();
  8. board.addChild(blank);
  9. }

Step 20: Get Colors Value

To get the value of the colors we're using in the Colors MovieClip, we convert it to a BitmapData Object and use the getPixel method to obtain the RGB value of the pixel clicked.

  1. private function convertToBMD():void
  2. {
  3. colorsBmd = new BitmapData(colors.width,colors.height);
  4. colorsBmd.draw(colors);
  5. }
  6. private function chooseColor(e:MouseEvent):void
  7. {
  8. pixelValue = colorsBmd.getPixel(colors.mouseX,colors.mouseY);//Gets the cliked pixel RGB value
  9. activeColor = pixelValue;
  10. /* Use a ColorTransform object to change the shapeSize MovieClip color */
  11. ct.color = activeColor;
  12. shapeSize.transform.colorTransform = ct;
  13. }

We'll add the chooseColor listener in the addListeners function later in the code.

Step 21: Active Tool

Earlier, we declared a variable to set the active or current tool in use, and we call this function to remove the corresponding listeners in order to have just one active tool.

Basically, the function checks the "active" variable in a switch loop, then depending on its value removes the listeners it has.

  1. private function quitActiveTool():void
  2. {
  3. switch (active)
  4. {
  5. case "Pencil" :
  6. board.removeEventListener(MouseEvent.MOUSE_DOWN, startPencilTool);
  7. board.removeEventListener(MouseEvent.MOUSE_UP, stopPencilTool);
  8. case "Eraser" :
  9. board.removeEventListener(MouseEvent.MOUSE_DOWN, startEraserTool);
  10. board.removeEventListener(MouseEvent.MOUSE_UP, stopEraserTool);
  11. case "Text" :
  12. board.removeEventListener(MouseEvent.MOUSE_UP, writeText);
  13. default :
  14. }
  15. }

We also need to highlight the active tool and hide the other ones:

  1. private function highlightTool(tool:DisplayObject):void
  2. {
  3. tool.visible=true; //Highlights tool in the parameter
  4. }
  5. /* Hides the tools in the parameters */
  6. private function hideTools(tool1:DisplayObject, tool2:DisplayObject):void
  7. {
  8. tool1.visible=false;
  9. tool2.visible=false;
  10. }

Step 22: Shape Size

We click the Size Panel or the ShapeSize MovieClip to change the size of the Pencil, Eraser and Text Tool. The size is changed in intervals of 5, and is reset when the size is bigger or equal to 50. Take a look at the code:

  1. private function changeShapeSize(e:MouseEvent):void
  2. {
  3. if (shapeSize.width >= 50)
  4. {
  5. shapeSize.width = 1;
  6. shapeSize.height = 1;
  7. /* TextFormat */
  8. textformat.size = 16;
  9. }
  10. else
  11. {
  12. shapeSize.width += 5;
  13. shapeSize.height=shapeSize.width;
  14. /* TextFormat */
  15. textformat.size+=5;
  16. }
  17. }

Step 23: Add Listeners

A function to add all the listeners.

  1. private function addListeners():void
  2. {
  3. pencilTool.addEventListener(MouseEvent.MOUSE_UP, PencilTool);
  4. eraserTool.addEventListener(MouseEvent.MOUSE_UP, EraserTool);
  5. textTool.addEventListener(MouseEvent.MOUSE_UP, TextTool);
  6. saveButton.addEventListener(MouseEvent.MOUSE_UP, save);
  7. clearTool.addEventListener(MouseEvent.MOUSE_UP, clearBoard);
  8. colors.addEventListener(MouseEvent.MOUSE_UP, chooseColor);
  9. sizePanel.addEventListener(MouseEvent.MOUSE_UP, changeShapeSize);
  10. shapeSize.addEventListener(MouseEvent.MOUSE_UP, changeShapeSize);
  11. }

Step 24: Test

Test your app by pressing cmd+return and check if everything is working as expected.

Use all the tools, colors and functions and start drawing your scene!

Conclusion

This Flash Movie can be easily adapted as a kids drawing application, it has a friendly user interface and basic tools that can teach how the mouse works whilst having some colorful fun in the process.

You can also explore the rest of the as3corelib and read its documentation to learn some new ActionScript features.

Thanks for reading!

|| .Navigation

Top blogs of the month

Download Kaspersky key for free direct link in zip file
http://kasperskykey.byethost13.com

Download kaspersky kav kis key (kaspersky key)
http://key-kaspersky.blogspot.com

get Free Web Hosting , get Free Domain name
http://albramj.blogspot.com

Download all arabic fonts
http://all-fonts.blogspot.com

buy and sell Compare PC and laptop prices - the best price compare prices
http://1st-emarketing.blogspot.com

Download flash tutorial - cartoon smart xml AS2 AS3
http://flash-torrent.blogspot.com

Download joomla tutorial, joomla templates plugin tools
http://all-joomla.blogspot.com

Download Money magazine, find investor
http://i-need-investor.blogspot.com

Download photoshop tutorial CS4 CS3, photoshop sources
http://pramjy1.blogspot.com

Google Adsense: Earn Million Dollars Per Year
http://password-prog.blogspot.com

Download lynda tutorial CS4 CS3, lynda lessons
http://lynda-torrents.blogspot.com

Download photoshop tutorial CS4 CS3, photoshop source
http://photoshop-torrent.blogspot.com

Download top programs TV show software movies
http://top-55.blogspot.com

Download most popular games Fifa 09 need for speed
http://500game.blogspot.com

Download total training tutorials CS4 CS3,
http://total-training-torrent.blogspot.com

Download 3d Max tutorial CS4 CS3,
http://3dmax-torrent.blogspot.com

Forex Video Tutorial : Place a Trade



Learn how to enter and exit the market quickly and efficiently with automated click and deal trading. This video tutorial will also show FOREXTrader's advanced position management capabilities.

Length: 1:02 minutes

Forex Video Tutorial : Associated Orders



Learn how to attach an associated limit and stop loss order to an open position.

Length: 1:48 minutes

Forex Video Tutorial : Point & Shoot



The Point & Shoot tool enables you to drill down into a position to view and close any individual trade that is part of your overall position in any currency pair. Learn more about the Point & Shoot feature by watching this tutorial.

Length: 00:57 seconds

Forex Video Tutorial : Forex Insider



Learn how to quickly access FOREXInsider, live market commentary written by our senior traders and members of our research team.

Length: 00:45 seconds

Forex Video Turorial : Customize Layouts



FOREXTrader is fully customizable. Learn how to create your own layout or select from our predefined layouts, geared specifically to popular trading styles.

Length: 1:08 minutes

Forex Video Tutorial : FOREXTrader Platform Tour



Designed for active traders looking for an edge, this Windows-based platform offers a rich user interface in a highly customizable trading environment for maximum performance. Watch the demonstration of all the tools and resources available on the trading platform.

Top serch of the week

antivirus kaspersky Flash CS4 cartoonsmart blend torrent download full cs3 antivirus key kaspersky 5 kaspersky 5.0 kaspersky 6.0 web hosting kaspersky anti kaspersky anti-spam kaspersky antivirus key kaspersky crack kaspersky key kaspersky keygen kaspersky license key kaspersky personal kaspersky pro Forex Video Tutorial : Place a Trade Forex Video Tutorial : Associated Orders Forex Video Tutorial : Point & Shoot Forex Video Tutorial : Forex Insider Forex Video Turorial : Customize Layouts Forex Video Tutorial : FOREXTrader Platform Tour kaspersky virus licence key license key serial key acm forex automated automated forex best forex broker brokers cfd charting charts cms forex crown forex currencies currency currency converter currency exchange daily forex directory euro exchange rate exchange rates foreign currency foreign exchange forex forex analysis forex auto forex autopilot forex autopilot system forex bank forex blog forex book forex books forex broker forex brokers forex chart forex charts forex chat forex club forex contest forex course forex currency forex dealer forex demo forex ea forex exchange forex factory forex forum forex forums forex funnel forex indicators forex killer forex learning forex market forex market hours forex news forex online forex option forex platform forex profit forex rates forex recommendation forex secrets forex signal forex signals forex software forex strategies forex strategy forex system forex technical analysis forex tracer forex trade forex trader forex trading forex trading strategies forex trading system forex training forex trend forex video free forex free forex signals futures fx fxcm gci forex hedging learn forex live forex managed mini oanda pip pips platform quotes rates real time forex reuters sek signals stock arket street technical analysis the forex top forex trader traders trading valuta تجارة العملات