Sunday, December 21, 2008

Common library for your Flash application

Hi,
In this i like to tell a simple way how to use the same movie clip in all your files with out any searching.

By using Common library.....

First create a file consider your logo so that in what ever file you like to put the corresponding logo can be placed with easy way.
Create a Flash file with a library containing the logos and all your movie clip you want to use.
Place the Flash file in the location
C:\Documents and Settings\\Local Settings\Application Data\Adobe\Flash CS3\en\Configuration\Libraries\
And now check your flash windows -> common libraries You can see the file name you placed :-)

Now whatever movie clip you want to import which is in the common library just go to windows -> common libraries -> You will get the movie clip in a separate library you can drag it to the working area to include in the new file....

Enjoy the cool stuff...

Friday, December 19, 2008

Group your flash files

Hi,
In this i like to tell a tips how to handle more flash files to group into a single one file and open the related files whenever you want.




This can be done with a file called flash project file it has the extension .flp

You can do this by going to file->new and the window will appear in that select the Flash project and then add all your fla project and .as files to it by clicking the Add files in the bottom of the project window. you can get the project window from windows->project or Shift+F8









By doing so you no more need to get confuse what are the files involved in the current project.
Planing for a BIG project start with project file in flash












if t is useful plz leave a comment

Saturday, December 13, 2008

Make flash full screen in browser

Hi,
In this blog i like to explain How to make the flash in full screen of the browser...
You might notice some of the flash site where you can find all the area of the browser will be a flash That can be done using the publishing setting as follows in flash.
go to file-> publish setting a dialog box will appear in that find weather the HTML tab is available in the below image you can see the image where i sport it out...
Set the corresponding settings





Set as percent in Dimension
By default it will be 100 and 100.if it is not change to 100 and 100.



Set the scale as No scale.
so that your file will not get scale alignment as center and center. So that the flash file will be align in center




Once you set this options just publish the file
You can find a .html file in the folder.
open it in dream viewer Modify->page properties









set all margin as 0 (Zero)





Now your flash will be setting to the full screen in browser.

Check it out and enjoy

Tuesday, December 9, 2008

Update a image 3 Option

Hi,
I like to explain how to Update a image in the flash.

Option 1:
In this option you need to know from where you placed the image initially. You need to update that image with New one.
Open the Library (ctrl + l), Right click the image and give update it will update the image so that it will affect the image int the work area.

Option 2:
In this option you no need to know wher was the old images was.
You can open the library and selsct the image and right click and give properties.
a dialog box will get open in that give the click import and select the image you want to update.
it will get updated...

Option 3:
In this option if you thought of updating only one image(in the work area) and the rest must be same you can go for this option.
import the images into the library by file->import-> import to library...
and click the image in the work area open properties (ctrl +F3) and give swap.
The dialog box will open in that select the New images.

Saturday, December 6, 2008

Rectangle primitive Tool

Hi,
I like to explain a small tool where most people don't use to use it......
It is called as "Rectangle primitive Tool" by default it use to the the sub tool in the Rectangle tool in Tool panel.

If we thought of drawing a curved edge rectangle this Rectangle primitive Tool is useful.
Even after drawing a curve we can adjust the curves.
It is too efficient in the way like making changes in all 4 corners separately . Where you can get the exact way of you want. The most highlight is you can edit whenever you want.....




I hope you got some New thing regarding flash

Cool fine

User option button

Hi,
In this i like to explain how to create User option button.

create a movie clip with two frames and make the first frame as off and second as on.
Place the art work like on a option button in first frame as off and second one as on and place a stop(); command in the first frame action script window so it will resemble as the below one...



copy and past the same movie clip option in the main time line and name it as op1 and op2.
which look like the image specified below.


//code is as followes
op1.gotoAndStop("on"); //set The option 1 as default on
op2.gotoAndStop("off"); //set The option 2 as default off
_root.selected_option=1; //storing the selected value for future reference

//function for option 1 button when clicked
op1.onRelease = function()
{
if(_root.selected_option<>1) //check weather the option 1 is not selected
{//if not selected
op1.gotoAndStop("on"); //make the option1 movie clip as on
op2.gotoAndStop("off"); //make the option2 movie clip as off
_root.selected_option=1; //set the value as 1
}
}

//function for option 2 button when clicked
op2.onRelease = function()
{
if(_root.selected_option<>2) //check weather the option 2 is not selected
{//if not selected
op1.gotoAndStop("off");//make the option1 movie clip as off
op2.gotoAndStop("on");//make the option2 movie clip as on
_root.selected_option=2; //set the value as 2
}
}

Friday, December 5, 2008

panning using Flash AS 2.0 code

Hi
I like to put a small game code for moving a object with ease

create a movie clip with some thing like face or ball or what ever inside it.
place the movie clip inside the work Area name it as obj. copy and paste the code below in the first frame and execute now where ever you click the mouse your object follow it....
Done...

//your code hear
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
_global.xpoint = _xmouse;
_global.ypoint = _ymouse;
};
Mouse.addListener(mouseListener);

obj.onEnterFrame = function() {

var dy:Number;
var dx:Number;
dx = 0;
dy = 0;
dx = ((_global.xpoint)-this._x)/5;
dy = ((_global.ypoint)-this._y)/5;
if (Math.abs(dx)<0.4) {
dx = 0;
} else {
this._x += dx;
}
if (Math.abs(dy)<0.4) {
dy = 0;
} else {
this._y += dy;
}
};
//End of your code

cool fine

Thursday, December 4, 2008

Strange Problem(fixed)

I was using Flash CS3,
In that some time when i open all ready created flash file the vector animated object in that use to get flicker then if i go through the full time line it use to start work properly it was happening in some of my files.
Fixed
In that case one day i try opening the font mapping in Edit and substitute the fonts it stats working properly now. When it happens once again just went to Edit -> font mapping substitute the font ....
Strange but solved a big problem for me... Hope some one also face the same problem Just for you guys....

if some one faced this problem Plz comment on this...

Class and Function in AS3

Hi Guys,
This is my first tutorial in AS3.
The big change in AS2 and AS3 is Object Oriented Programming.

In AS3 all are considered as Object, Class. In this let me say What is Class ? , What is Object? , What is Package and their syntax.

Package:
Package is the collection of class. Class needs to be specified with in a package.

Syntax:
package
{
....
...
}

Class:
Class is the collection of function and variables.

Syntax:
class
{
...
...
}

type can be of 4 types : dynamic, final, internal, public where internal id default.

Object:
Object is the instance of class. Hear is the power of Object oriented programming by creating a single class we can create multiple objects.

var : = new ();

Example with all package, class, object...

//sample.as
package
{
class sample
{
sample()
{
trace("Hi");
}
}
}

//main.fla
var my_obj:sample = new sample();

Note : Both main.fla and sample.as must be in the same place.
Note : AS3 is case sensitive.

Wednesday, August 20, 2008

Swap movie clip

Hi,
In this i like to say how to change a single movie clip to other...
Some time we might need to change a particular item in a movie clip we can do that with the option called swap.

It can be done in the way of.
Select the movie clip what you want to change.
Select the properties window(ctr +F3 to open the properties).
Click the button swap and select the movie clip to change.
It will get replaced.

Note : In the case of swap a movie clip inside another Movie clip it will affect all the place where that main movie clip is used movie clip.

Wednesday, July 30, 2008

Jokes i liked

Hi,
some jokes i liked

Teacher :What happened in 1869?
Student:Gandhi ji was born.
Teacher :What happened in 1873?
Student:Gandhiji was four years old.


Question:What is the fullform of maths.
Anwser:Mentaly affected teachers harrasing students


Teacher :Because of Gandhiji's hard work what do we get on 15th August.
Student:A holiday


Teacher :Tomorrow there will be a lecture on Sun.Everyone must attend it.
Raju:No ma'm! I will not be able to attend it.
Teacher :Why?
Raju:My mother will not allow me to go so far!!!


Teacher:"Can anyone give me an example of Coincidence?"
Johnny:"Sir, my mother and father got married on the same day same time."


Teacher: How old is ur father.
Sunny:As old as I am.
Teacher:How is it possible?
Sunny:He became father only after I was born. (1st Rank)


Teacher:There is a frog,Ship is sinking,potatoes cost Rs 3/kg .Then,what is my age?
STUDENT:32 yrs.
Teacher:How do you know?
STUDENT:Well,my sister is 16 yrs old and she is half mad.


Teacher: Where does God live?
Little boy: I think he lives in our bathroom.
Teacher: Why do you say that?
Little boy: Well, every morning my daddy bangs on the door and says, 'God, are you still in there?'


Teacher:"What is your name?".
Student:"Mera naam Suraj Prakash hai."
Teacher:"When I ask aquestion in english,answer it in english."
Student:"My name is Sunlight."

hahaha... Just for laugh enjoy

Problem and solution of simple pre loader

Hi,
This can be specified as the continuation of the older post where i like to say where we cant use the simple pre loader

Problem
* when you load a swf inside another movie and the inside movie has this script then this will not work. Since this will check for the root movie clip where that is all ready loaded in the client system.

Solution
* insterd of using the _root replace it with the key word this where this will be referring the present/current swf so that the problem will be solved.

This solves a major problem since we no need to care of which swf is getting loaded to which one.
But still some more question rises yes let me tell what is the next step of pre loader in the Advanced pre loader.

simple Preloader

Hi,
In this I like to tell how to create a pre loader

place a dynamic text field with the name pre. Make sure this text box extends in the first 3 frames

Frame 1 code:
per.text = "0%";

Frame 2 code:
pre.text = (Math.floor(_root.getBytesLoaded()/_root.getBytesTotal()*100)+"%");
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
pre.text = "100%";
gotoAndPlay("main_movie");
}

Frame 3 code:
gotoAndPlay(2);

Frame 4:
Place a label as main_movie

This is the most common and simple type of pre loader

as i all ready specified place a dynamic text field which is over there in all the first 3 frame
this will start play in that case the first frame will set the text field as 0%.
Then it will come to 2nd frame and check weather the total size of file in bytes is equal to total number of bytes loaded, if it is equal it will go and play the 4th frame where it is named as main_movie or else it will go to the 2nd frame where it will check once again for the total bytes loaded with the Total file size.
hope this will help...
Let me tell some advanced type of pre loader soon.

Friday, July 4, 2008

Nice trick to load a flash site or html site

Hi,
This is a simple but tricky way of loading flash website or html site.
basically most people use to create two website with flash version and html version of same site.
In that case some use to go for a complected way to solve this way this is some simple way to solve this.

Situation: is if the browser has a flash player installed then it needs to link to flash site and if there is no flash player then it will link to the HTML site.

Solution:
Step 1 : make ready the main flash site and the html site. let consider the htmlsite main page as html_main.html and flashsite as flash_main.html.
Step2 : create a separate flash file with the low dimension 1 X 1.
Step3 : In this first frame place a code to load the flash site as getURL("flash_main.html");
step4 : in the file which has the 1X1 dimention file put the code as

<META HTTP-EQUIV="Refresh" CONTENT=5; URL=html_main.html">

in the first line of your main index file.
your got the result. Simple right check below how it work...

How it work.

If the flash player is installed then the flash will get load and it will load the flash site this is the first case.
If the flash player is not there it will not load any flash file (the 1X1 dimention file) and no redirecting to the flash site will happen.
In that place the code in the html page will refresh and redirect the html page to the new html site this is second case...

Most people might knowing this logic but any how i found this logic intresting so i shared with you...

i has also put the same procedure to my site www.gbala.com...
Cool enjoy...

How to get the frame number

HI,
This is not much useful but will be needed for some reason.
There is a function called _currentframe which is used to get the current time line frame.
This is also used inside the movie clip like movieclip_name._currentframe which will return the particular movie clip's current frame number.

eg
trace(mc_1._currentframe );

displayes the mc_1 movie clip current frame number

Wednesday, July 2, 2008

transparent page in flash

Hi
I like to say how to create transparent background in flash for a web page.
Create a flash with a transparent effect...

and save the file and select file -> publish setting (second image)
select the html tag and select window mode as "transparent window" the file you will get a html file with transparent option file.

How to check this:
* You can change your back ground color and get the transparent file affect the flash file.
Like the output shown below where i specified below is with blue back color


the check will be similar to this below image

Enjoy getting this.

Friday, June 20, 2008

getBytesLoaded,getBytesTotal

Hi guys,
In this i like to tell a function called
getBytesLoaded
This is a function used to find out how much of bytes loaded in the system.
getBytesTotal
This is a function used to find what is the total size of the flash file which is getting loaded.

this are the two function used to create a preloader.... In my next tutorial i will explain the preloader with example...
catch you soon...

Wednesday, June 18, 2008

setting different style in a single text box

Hi Guys,
I like to explain you some of my tips in editing the text with different font in a single text box.


This is not much difficult even though in some case it will be useful. This will work fine in the normal static box if you go for the dynamic text box like in the case of more content with scroll bar this will be more useful


  • Place a text box (you can refer my old topic to place the text bix and set the scroll bar).
  • You can find a button with the symbol <> just click it and you can edit a particular text and modify
You can get the effect like in the top textbox
meet you in the next soon

Tuesday, June 3, 2008

cookies in flash

Hi
in this section i like say few tips like how to store cookies with flash...

SharedObject:
This command used to retrieve data from the local system.

SharedObject.getLocal("user_profile");
will get the value from the file called user_profile where each swf will be stored in different location related to the name of the file.

let me specify a example on it

user = SharedObject.getLocal("user_profile");
if (user.data.name == undefined)
{
user.data.name="cookie";
trace("cookie is stored");
}
else
{
trace(user.data.name);
}

let me explain the code above
user = SharedObject.getLocal("user_profile");
this line will read the data from the local system.
if it find any value it will read the value of the variable or it will specify undefined if it is empty.
by checking the value of the variable we can ad the stored cookie value.
The line user.data.name="cookie"; will store the value cookie to the variable user.data.name.

Useful in.
This will be used to store some client detail in to his system like his user name and other detail in his system.
It is also used to find out weather the person has come to our site or not.

Friday, May 30, 2008

_global variable

Hi,
This is most known function to any one use flash action script.
If you want to store a value for the entire website then we can use the _global variable where it can holed any type of data.

we can assign a value with the prefix _global.
where this will create a variable for the whole flash so that you can use this value where ever you want after declare or assign a value.

syntax :
_global.variablename ="";

eg:
_global.
variablename ="This is a global variable.";

Thank you,
catch you soon...

Emberd font in flash 8

Hi,
In this I like to say the steps how to embed a font in flash.

I flash putting a font for a static text is more simple... Just specify the particular font it will work fine but in this i like to say how we can specify for a dynamic text.

For dynamic text...
  • Create the text field and set the property of the text to dynamic.
  • In the font field specify the font you want to embed and in then you can find a embed button just click that and specify All
  • In case of you want only specific character you can avoid All and select the corresponding selection like uppercase or/and lowercase or/and Number or/and punctuation etc...
Note 1 : If you specify All the file size use to get bigger since it embed all the character so if you thing it is going to have only upper or lower or Number just apply only that so that flash will not embed all the character set.
Note 2 : The same thing is also applicable for the text with input property...

Get back to you soon with more hints and tips....

Wednesday, May 28, 2008

set scrrollbar in flash

Hi,
I like to tell how to set a scroll bar for a text box more common way of doing...

  • Create a text box by clicking in the tool bar and place it in the working area.
  • Type as much as words as your wish or need.
  • In the property window set the text type as Dynamic and also specify the name for it.
  • Now right click the text box and give the option scrollable now you can notice a black square in the corner of the text box which represent that it is capable of scrolling .
  • Now open the component window by window->components or just press ctr+f7
  • Inside user interface you can find UIScrollBar drag that into the working area.
  • In the parameter of the UIScrollBar set the _targetInstanceName as the text box name.
  • Now run the file by ctr+enter you can scroll the text in the text box using the scroll bar
let me catch you with some more functions...

Monday, May 26, 2008

Funney Images






The images i liked and enjoyed

Load web Page using flash

In this tutorial I will tell you how to load a page in the flash.

You can load a page by setting to a specific text or button let me tell both option

1) option 1 (using text)
  • create a text from tool box.
  • open the property window.(you can do this by window->properties -> properties.
  • select the text box set as static text.
  • you can see the link icon in the property window now give your page load there and set the target.
  • you can see dotted line under the text which represent it is linked
2)option2 (using button)
  • create a button.
    draw some box or circle like your wish and select that and press f8 a window will pop up and there will be 3 option where you need to select button to creat a button.
  • right click the button goto action or just press F9 to open action window or goto windows->Actions
  • use getURL function to link to the url
    on(release)
    {
    getURL("yoururl", "_self");
    }
  • the function getURL has 3 parameter namley
    URL
    target
    variables
  • url is the path of the location whre it has to load
  • target is having 4 option _self,_parent,_blank,_top similar to the html...
  • variable has 3 option dont send any data, post,get is similar to the method in form tag

Let me see with you a new function soon

Difference between _root and _parent

Hi,
This is my first post....
Let me start with what is the difference between _root and _parent in flash....
This will be useful for the person who likes to goto flash Action script who knows flash...

Both _root and _parent can be used for referring a object in action script.

_root
is used for referring the top most level of object.
for example
if you creat a movie clip called mc_one and mc_two inside mc_one then the _root refer outside the mc_one. that is the first level of the object.
_root -> mc_one -> mc_two
note : if you load a movie clip inside another flash file then the loading movie clip will not be considered as the _root instead of that the main movie clip will be considered as the _root
for example
take the previous example (_root ->mc_one -> mc_two) is loaded in another file then the loaded file will not have _root only the main file witch loading will have _root
_root->loading_mc->mc_one->mc_two

_parent
This is used to go to one step backwards.
for example
consider the same example _root -> mc_one -> mc_two
and wright the script in mc_two it will refer to mc_one
and if we want to refer to more upper level we can use _parent._parent

Conclusion
so it will be better to use _parent since even if you make multiple level of file and made it to link from another file it will not affect the separate file...

Hope it will be helpfull for action script beginners

Tutorial

Hi Guys,
I like to put some tutorial in my blog....
Mostly what i feel how i got a logic and other things...
some thing might be not much useful but some thing might satisfy yourself....

Mostly it will be Flash.....

I also like to share some joke what i heard or read so hope you will get both entertainment as well as knowledge hear...
Keep commenting enjoy.....

Saturday, May 24, 2008

Hi guys

Hi guys this is balamurugan.....
hope will start blogging now