Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple use of functions in flash

Status
Not open for further replies.

kanwal

Instructor
Sep 1, 2001
2
GB
it is an emergency please if someone help me out.
I want know about simple use of these functions in flash using code in a very simply way
boolean,escape,false,gettimer,int,isFinite,isNan, maxscroll, parseFloat,scroll, string, targetpath,true, unescape, updateAfterEvent. pLEASE MAKE THESE FUNCTIONS USING OUTPUT WINDOW OR in simple function. will be verythank full to the person who will do it.
 
Nothing else? Wouldn't like the site moved a little to the left? ;-)

Here's some easy versions of some of these - I'm sure other people will contribute too...

updateAfterEvent() - the simplest way to use this is in something like...

onClipEvent(enterFrame){
_x++;
updateAfterEvent();
}


which would move any movieClip that it's attached to across the screen in one pixel steps. The update.. function refreshes the screen immediately after the move takes place which smooths out the motion rather than waiting for everything else in the frame to happen before the screen is updated which looks more jerky. You can add things like (mouseMove) instead of empty () as well.

true and false are easy, they can be used to help your script make decisions. The most basic way to demonstrate them would be in something like...

if (condition=true){
//do something
} else if (condition=false){
//do nothing
}


getTimer() reads the time since the movie started in milliseconds. It's useful for creating pauses in a movie or starting events at specific times amongst other things...

onClipEvent(load){
movieStartTime=getTimer();
clipStartTime=movieStartTime+5000;}

onClipEvent(enterFrame){
if(clipStartTime<getTimer()){
exampleClip.gotoAndPlay(2);
}


this gets the value of getTimer() and sets a variable to its value. Using this it sets another variable which is 5000 more. The next section compares the new variable to the timer every frame - when the timer is a larger value than the variable it starts a movie clip. In other words the script sets a 5 second delay (5000 milliseconds) before starting a movie clip.

int returns an integer value of any number. Integers are whole numbers ( 1, 2, 34, 56, etc). So..

newValue=int(28.987);

would set newValue to 28. This is a Flash 4 thing, Flash 5 wants to replace it with math.floor() but int takes less time to type :) .

isNaN() or &quot;is not a number&quot; - this evaluates the expression in brackets and returns true if it's not a number and false if it is a number...

isNaN(&quot;hello&quot;);//returns true

isNan(21);//returns false

escape URL encodes a string - useful for making sure output is formatted correctly for server side scripts. To be honest though as you're asking what string means in the question above you've got a lot of things to work out long before you get to this kind of stuff, likewise with the boolean object - get used to true and false beforehand....


 
sorry, must have been asleep...

if (condition==true){
//do something
} else if (condition==false){
//do nothing
}


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top