-
Flashkit Veteran
function(???)
what is the use of putting something inside those bracets
-
makes it look puuuurrty()
-
Retired SCORM Guru
Brackets? { }
Or Parenthesis? ( )
The brackets deliniate blocks of code. Without them you'd have line after line of code running together. The brackets tell the compiler where your function or conditional ends.
Parenthesis are used to pass parameters to functions. If a function doesn't take a parameter, you don't put anything inbetween them.
For instance: gotoAndPlay() is a global function. It tells the playback head to jump to a certain frame and start playing from there. You've got to have a way to tell that function which frame you want it to go to. Enter the parameter: gotoAndPlay(10).
stop() doesn't take any parameters. However, since it's a function, it needs to follow the syntax rules, hence the empty parens.
"What really bugs me is that my mom had the audacity to call Flash Kit a bunch of 'inept jack-asses'." - sk8Krog
...and now I have tape all over my face.
-
Brackets: [ ]
Curly Braces: { }
Parentheses: ( )
-james
-
Flashkit Veteran
cha i know how to actionscript i was just wondering if liek a function says function dogfunc(kill) {
what does the kill part do
-
i was just wondering if liek a function says
function dogfunc(kill) {
what does the kill part do
It's an argument of the function. A variable whose value will be determined when the function is invoked. This comes in handy when you need to reuse the function.
Let's look at a simple javascript, used for opening a new window:
<script>
<!--
function newWin(){
var myWin = window.open('http://www.msn.com','myWin0','width=400,height=400');
}
//-->
</script>
And the anchor tag:
<a href="javascript:newWin();void(0);">Open New Window</a>
Now, that script is fine...if you only want to open one new window But everytime you invoke the function newWin(), you're going to get a 400x400 window, named myWin0, directed at http://www.msn.com.
But suppose you wanted to open many windows, all different sizes, with different names, and all going to different urls...
Then you'd do something like this:
<script>
<!--
function newWin(url,winName,w,h,top,left){
var myWin = window.open(url,winName,'width='+w+',height='+h+', top ='+((screen.height-h)/2)+',left='+((screen.width-w)/2));
}
//-->
</script>
Then the anchor tag would look like this:
<a href="javascript:newWin('http://www.msn.com','myWin0','300','300','top','left');vo id(0);">Open New Window</a>
So from this one script, you could launch any number of new windows:
<a href="javascript:newWin('http://www.flashkit.com','myWin1','500','250','top','left');void(0);">Open New Window</a>
<a href="javascript:newWin('http://www.lycos.com','myWin2','600','500','top','left');void(0);">Open New Window</a>
etc.
-james
Last edited by jamescover; 07-17-2004 at 04:39 AM.
-
WaAaAaAayYyYyYyYYy over my head
LOOK!! UP THERE ^
THERE IT IS!!
WHOOSH!!!!
----------------->
-
Flashkit Veteran
hmm that makes a little sense but i am bnot that god with any type of scripting except a/s so could you elate it too that i really appreciate your help james
-
so could you elate it too that i really appreciate your help
Okay, a simple AS example:
You could a create a function like this:
function getFrame(x){
_root.gotoAndPlay(x);
}
Then, on a button, instead of:
on(release){
_root.gotoAndPlay(15);
}
You would use:
on(release){
getFrame(15);
}
makes sense, right?
-james
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|