IT Community - Software Programming, Web Development and Technical Support

Flash Tips & Tricks

This is a discussion on Flash Tips & Tricks within the Flash Actionscript Programming forums, part of the Web Development category; Hi, I have started this thread only for FLASH tips & tricks. Here I am going to give the tips ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Flash Actionscript Programming

Register FAQ Members List Calendar Mark Forums Read
  6 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 03-28-2007, 02:07 PM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Default Flash Tips & Tricks

Hi,

I have started this thread only for FLASH tips & tricks. Here I am going to give the tips and tricks in Flash.

Here is the first one.

When Working with MovieClip object, Donot use onPress, OnRelease event for the movieclip, if it is containing the button objects in it.

Because if you enabled the onpress or on release event, then the button click will not be raised.

thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-29-2007, 02:22 PM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Thumbs up Re: Flash Tips & Tricks

Flash Tip: Convert Lines to Fills

Flash has the option to take any line/stroke that you’ve drawn and convert it to a fill instead, affecting its behavior and how various Flash drawing tools and their settings will operate on them. To do this, select the fill that you want to convert, and click Modify->Shape->Convert Lines to Fills.

thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-29-2007, 02:28 PM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Thumbs up Re: Flash Tips & Tricks

Paint Bucket Tool

The options for the Paint Bucket tool control just how "tolerant" the flood fills are.
If you set it to Don't Close Gaps, then the Paint Bucket Tool will only work to fill completely enclosed areas of a shape (that is, shapes that are completely bounded by a line with no broken spaces).

But if you set it to Close Small Gaps, it will ignore small breaks in the bounding lines to fill the enclosed area. Close Medium Gaps and Close Large Gaps will cause the Paint Bucket tool to ignore larger and larger spaces in the bounding lines to treat them as enclosed areas.

thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-29-2007, 02:51 PM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Thumbs up Re: Flash Tips & Tricks

Working with text in FLASH tips

Add a text into your flash document.

Select your text and press Ctrl +b, which breaks the text into separate letters, you can move the letters around and make the text look strange if you want to.

But if you want to edit your text even more select all of the letters and press Ctrl + b again. Now they are all shapes that you can freely edit. So have a play around and change how your text looks. Use the arrow tool and change the edges of the text.

thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 03-29-2007, 07:51 PM
aquariancore aquariancore is offline
D-Web Sr.Programmer
 
Join Date: Feb 2007
Posts: 161
aquariancore is on a distinguished road
Default Re: Flash Tips & Tricks

The last tip about text was something I have been overlooking and yet probably knew about. Thanks it will help me with one of my projects.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-02-2007, 02:41 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Thumbs up Re: Flash Tips & Tricks

Hi,

Here I have given the short cut key for image open and scaling.

To add a jpeg image to your flash document, press Ctrl+r.

If you want to scale the selected image file, Press Ctrl+Alt+S, the scale window will be appeared. Give the scale value.

thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-04-2007, 02:12 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Default Re: Flash Tips & Tricks

Scripting Filters
Professional 8 includes a range of filters that allow
you to add special effects to objects on the Stage.
here I have given the list of filters:
Bevel
Blur
ColorMatrix
Convolution
DisplacementMap
DropShadow
Glow
Gradient Glow
Gradient Bevel
You can apply these filters in design time itself to the movie clip or any other objects.

In action script, you can use like this...
var theBevelFilter = new flash.filters.BevelFilter();
var theBlurFilter = new flash.filters.BlurFilter();
var theColorMatrixFilter = new flash.filters.
ColorMatrixFilter();
var theConvolutionFilter = new flash.filters.
ConvolutionFilter();
var theGlowFilter = new flash.filters.Glow-
Filter();
var theGradientBevelFilter = new flash.filters.
GradientBevelFilter();


thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-05-2007, 08:28 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Thumbs up Re: Flash Tips & Tricks

Here is the tips to find a string in a given string. In action script, there is no function available like "instr()" in VB. to find a string we need to write a function like ..

function IsStr(SourceStr:String,FindStr:String):Number
{
var dumArr:Array=new Array();
dumArr=SourceStr.split(FindStr);
if (dumArr.length==1)
{
return -1;
}
else
{
var ActualStr:String=dumArr[0];
return ActualStr.length;
}
}

The above sample function will return a pos of the find string in the source string and if it is not found, then it will return -1.

hope it will be useful for you.

thanks
__________________
Karpagarajan. R
Necessity is the mother of invention

Last edited by Karpagarajan : 04-05-2007 at 08:46 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 07-20-2007, 02:11 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Default Re: Flash Tips & Tricks

Hi All,

Here is the Code tips for creating the Tool tip in your flex application.
class Tooltip {

private var theTip:MovieClip;
private var tFormat:TextFormat;

function Tooltip(hex:Number,hex2:Number) {

this.theTip = _root.createEmptyMovieClip("tooltip", _root.getNextHighestDepth());
this.theTip.createTextField("theText",this.theTip. getNextHighestDepth(),3,1,130,20);
this.theTip.beginFill(hex);
this.theTip.lineStyle(1, hex2, 100);
this.theTip.moveTo(0, 0);
this.theTip.lineTo(135, 0);
this.theTip.lineTo(135, 20);
this.theTip.lineTo(20, 20);
this.theTip.lineTo(10, 20);
this.theTip.lineTo(0, 20);
this.theTip.lineTo(0, 0);
this.theTip.endFill();
this.theTip._visible = false;
this.theTip.theText.selectable = false;
this.tFormat = new TextFormat();
this.tFormat.font = "Arial";
this.tFormat.size = 11;
this.tFormat.align = "center";
this.theTip.theText.setNewTextFormat(this.tFormat) ;

}

public function showTip(theText:String):Void {

this.theTip.theText.text = theText;
this.theTip._x = (_root._xmouse - this.theTip._width)+25;
this.theTip._y = _root._ymouse + 35;
this.theTip._visible = true;
this.theTip.onMouseMove = function()
{
this.theTip._x = (_root._xmouse - this.theTip._width)+25;
this._y = _root._ymouse+35;
updateAfterEvent();
}

}

public function removeTip():Void {

this.theTip._visible = false;
delete this.theTip.onEnterFrame;

}

}
to implement the tooltip class in your application, please copy the below code
var tt:Tooltip = new Tooltip(0xFFFFEC, 0x000000);
btn.onRollOver = function() {
tt.showTip("Previous Slide");
};
btn.onRollOut = function() {
tt.removeTip();
};
Hope it will be very useful for you

thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 07-20-2007, 05:24 AM
pesc pesc is offline
D-Web Trainee
 
Join Date: Jul 2007
Posts: 8
pesc is on a distinguished road
Default Re: Flash Tips & Tricks

Quote:
Originally Posted by Karpagarajan View Post
Hi,

Here I have given the short cut key for image open and scaling.

To add a jpeg image to your flash document, press Ctrl+r.

If you want to scale the selected image file, Press Ctrl+Alt+S, the scale window will be appeared. Give the scale value.

thanks

Hi Karpagarajan,

its good, if we dont know the exact value for scaling, there is a another option for scalling an object (may be image or shape or a movieclip somthing) press q when your object is selected the sacling mode appear arround the the selected object (now you can scale or rotate as your wish)
__________________
Thanks
-pesc-
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11 (permalink)  
Old 07-20-2007, 06:45 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Smile Re: Flash Tips & Tricks

Yeah that is there. Thanks posting the tips. And now Flash CS3 came. I will try to post new techniques in that. Keep on posting new techniques here. So that the people who wants to know flash tips, they can get it from one place instead of searching all over the web for a single tips.

thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 08-08-2007, 10:05 AM
kbala kbala is offline
D-Web Trainee
 
Join Date: Mar 2007
Posts: 5
kbala is on a distinguished road
Post Re: Flash Tips & Tricks

Hey All,

I have one tip for flash people who works with action script and the data comes from server programming or server side xml.

The tip is,

Use "mx.controls.Alert.show()" instead of using "getURL("javascript:alert('');")"

why because, the getURL function sometime fails to make alert, it will lead you to make false programming.

Thanks

-kb
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 08-30-2007, 04:43 AM
nssukumar nssukumar is offline
D-Web Sr.Programmer
 
Join Date: Feb 2007
Posts: 155
nssukumar is on a distinguished road
Default Re: Flash Tips & Tricks

when we set number of text box or buttons or combo
when we click tab it moves to next,
for example if you have a clip in that order,
tab does not work on the clip, for that you had to
enable the tab to true.
for example;
clip1_mc.tabEnabled = true;

then only tab works on the clip.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 09-20-2007, 07:02 AM
geoblow geoblow is offline
D-Web Trainee
 
Join Date: Jul 2007
Posts: 19
geoblow is on a distinguished road
Thumbs up Array copying (Array.concat method)

In actionscript if we copy an array like the below code. After that we changed any one array it will change that two arrays. See the code

Code:
var original:Array = [ 1, 2, 3 ];
var copy:Array = original;

copy[0] = 100;

trace( original[0] ); // 100
trace( copy[0] ); // 100
We can avoid this problem by using the method. See the below code

Code:
var original:Array = [ 1, 2, 3 ];
var copy:Array = [].concat( original );

copy[0] = 100;

trace( original[0] ); // 1
trace( copy[0] ); // 100
I hope it's useful.
Thanks
__________________
Geo
Actionscript Villain
geoblow.com
Atleast an inch move every day!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 12-28-2007, 12:04 AM
Balasubramanian.S Balasubramanian.S is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 181
Balasubramanian.S is on a distinguished road
Default Re: Flash Tips & Tricks

This is the sample way to create a flash menu.
HTML Code:
import mx.controls.Menu;
import mx.controls.MenuBar;
import flash.net.FileReference;
var openListener:Object = new Object();	
var fileRef:FileReference = new FileReference();
fileRef.addListener(openListener);

var my_mb:MenuBar;

var file_menu:Menu = my_mb.addMenu("File");
var edit_menu:Menu = my_mb.addMenu("Edit");
var view_menu:Menu = my_mb.addMenu("View"); 
var control_menu:Menu = my_mb.addMenu("Control");
var help_menu:Menu = my_mb.addMenu("Help");

file_menu.addMenuItem({label:"New Playlist", data:"Control+N", instanceName:"newInstance"});
file_menu.addMenuItem({label:"Open", instanceName:"openInstance"});
file_menu.addMenuItem({label:"Open URL", instanceName:"openUrlInstance"});
file_menu.addMenuItem({label:"Exit", instanceName:"exitInstance"});

view_menu.addMenuItem({label:"Full Screen", instanceName:"fullScreenInstance"});
view_menu.addMenuItem({label:"Half Size", instanceName:"halfSizeInstance"});
view_menu.addMenuItem({label:"Minimize", instanceName:"minimizeInstance"});

control_menu.addMenuItem({label:"Play", instanceName:"playInstance"});
control_menu.addMenuItem({label:"Pause", instanceName:"pauseInstance"});
control_menu.addMenuItem({label:"Next", instanceName:"nextInstance"});
control_menu.addMenuItem({label:"Previous", instanceName:"previousInstance"});
control_menu.addMenuItem({label:"Volume Up", instanceName:"volumeUpInstance"});
control_menu.addMenuItem({label:"Volume Down", instanceName:"volumeDownInstance"});
control_menu.addMenuItem({label:"Mute", instanceName:"muteInstance"});

help_menu.addMenuItem({label:" Help", instanceName:"helpInstance"});
help_menu.addMenuItem({label:"Shortcuts", instanceName:"keyBoardInstance"});
help_menu.addMenuItem({label:"About", instanceName:"aboutInstance"});

//Create listener object.
var mbListener:Object = new Object();
mbListener.change = function(evt_obj:Object)
{
 var menuItem_obj:Object = evt_obj.menuItem;
 switch (menuItem_obj.attributes.instanceName) 
 {
	 case "newInstance":
	  trace("New menu item");
	  break;
	  
	 case "openInstance":
	  openFile();
	  trace("Open menu item");
	  break;
	  
	 case "openUrlInstance":
	  trace("Open URL");
	  break;
	  
	 case "exitInstance":
	  trace("Exit menu item");
	  fscommand("quit", "None");
	  break;
	  
	 case "fullScreenInstance":
	  trace("fullScreenInstance");
	  fscommand("fullscreen", true);
	  break;
	  
	 case "halfSizeInstance":
	  trace("halfSizeInstance");
	  fscommand("fullscreen", false);
	  break;
	  
	 case "minimizeInstance":
	  trace("minimizeInstance");
	  break;
	  
	 case "playInstance":
	  trace("playInstance");
	  break;
	 
	 case "pauseInstance":
	  trace("pauseInstance");
	  break;
	  
	 case "nextInstance":
	  trace("nextInstance");
	  break;
	  
	 case "previousInstance":
	  trace("previousInstance");
	  break;
	  
	 case "volumeUpInstance":
	  trace("volumeUpInstance");
	  break;
	  
	 case "volumeDownInstance":
	  trace("volumeDownInstance");
	  break;
	  
	 case "muteInstance":
	  trace("muteInstance");
	  break;
	  
	 case "helpInstance":
	  trace("helpInstance");
	  break;
	  
	 case "keyBoardInstance":
	  trace("keyBoardInstance");
	  break;
	  
	 case "aboutPlayerInstance":
	  trace("aboutPlayerInstance");
	  break;
 }
 //trace(menuItem_obj);
};
//Add listener.
file_menu.addEventListener("change", mbListener);
view_menu.addEventListener("change", mbListener);
control_menu.addEventListener("change", mbListener);
help_menu.addEventListener("change", mbListener);

function openFile() 
{
	fileRef.browse();
	openListener.onSelect = function(file1:FileReference):Void  
	{
	  trace("Opened " + file1.name);	  
	};
}
__________________
S.Balasubramanian
Nothing is impossible

Last edited by Balasubramanian.S : 02-20-2008 at 01:04 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #16 (permalink)  
Old 12-28-2007, 09:42 PM
Balasubramanian.S Balasubramanian.S is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 181
Balasubramanian.S is on a distinguished road
Default Re: Flash Tips & Tricks

This is a simple way to create a right Click menu


onClipEvent(load)
{
//MENU.customItems.push(Functioned2);
MENU = new ContextMenu();
MENU.hideBuiltInItems();
Functioned = new ContextMenuItem("This movie is copyrighted by Your Company Name", doSomething);
Functioned2 = new ContextMenuItem("Visite Our Website", doSomething2);
MENU.customItems.push(Functioned);
MENU.customItems.push(Functioned2);
_root.menu = MENU;
function doSomething()
{
}
function doSomething2()
{
getURL("http://www.Discussweb.com", _blank);
}
}
__________________
S.Balasubramanian
Nothing is impossible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 02-18-2008, 01:46 AM
aramesh aramesh is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 71
aramesh is on a distinguished road
Default Re: Flash Tips & Tricks

Hi,
To Upload or Download a file using flash in web applications use "FileReference" class.
The FileReference class provides a means to upload and download files between a user's computer and a server. An operating-system dialog box prompts the user to select a file to upload or a location for download. Each FileReference object refers to a single file on the user's hard disk and has properties that contain information about the file's size, type, name, creation date, modification date, and creator type (Macintosh only).

FileReference instances are created in two ways:

When you use the new operator with the FileReference constructor: var myFileReference = new FileReference();
When you call FileReferenceList.browse(), which creates an array of FileReference objects

Thanks

A.Ramesh
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #18 (permalink)  
Old 02-18-2008, 01:51 AM
aramesh aramesh is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 71
aramesh is on a distinguished road
Default Re: Flash Tips & Tricks

Keyboard Keys and Key Code Values:

Letters A to Z and standard numbers 0 to 9:
HTML Code:
Letter or number key,           Key code,            ASCII key code
      A                            65                       65
      B                            66                       66
      C                            67                       67
      D                            68                       68
      E                            69                       69
      F                            70                       70
      G                            71                       71
      H                            72                       72
      I                            73                       73
      J                            74                       74
      K                            75                       75
      L                            76                       76
      M                            77                       77
      N                            78                       78
      O                            79                       79
      P                            80                       80
      Q                            81                       81
      R                            82                       82
      S                            83                       83
      T                            84                       84
      U                            85                       85
      V                            86                       86
      W                            87                       87
      X                            88                       88
      Y                            89                       89
      Z                            90                       90
      0                            48                       48
      1                            49                       49
      2                            50                       50
      3                            51                       51
      4                            52                       52
      5                            53                       53
      6                            54                       54
      7                            55                       55
      8                            56                       56
      9                            57                       57
      a                            65                       97
      b                            66                       98
      c                            67                       99
      d                            68                      100
      e                            69                      101
      f                            70                      102
      g                            71                      103
      h                            72                      104
      i                            73                      105
      j                            74                      106
      k                            75                      107
      l                            76                      108
      m                            77                      109
      n                            78                      110
      o                            79                      111
      p                            80                      112
      q                            81                      113
      r                            82                      114
      s                            83                      115
      t                            84                      116
      u                            85                      117
      v                            86                      118
      w                            87                      119
      x                            88                      120
      y                            89                      121
      z                            90                      122

Last edited by aramesh : 02-18-2008 at 02:31 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #19 (permalink)  
Old 02-21-2008, 09:26 PM
aramesh aramesh is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 71
aramesh is on a distinguished road
Default Re: Flash Tips & Tricks

How to download Flash object embeded in HTML Page?

There are two ways to download the (.swf) file,

1. First we want to know the file name of .swf, we can get it by

Right click the mouse
View Source and
Enter the key word .swf in find option.

we can get the file name.

Now, we can take this file from Temporary Internet Files folder in our system. While we visit or browse a site all file are stored in Temporary Internet Files, from this folder we can take all the files.

2. Second method is by using some swf catcher (like Sothink Swf Catcher) softwares we can download the file.

By using these methods only ill download the Flash object.

Regards
A.Ramesh
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #20 (permalink)  
Old 02-21-2008, 09:30 PM
aramesh aramesh is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 71
aramesh is on a distinguished road
Default Re: Flash Tips & Tricks

what is the other way of using Inheritance in flash?

Other way of inheritance in AS1 is "prototype"

and in AS2 its "interfaces"

Regards
A.Ramesh
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off