Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)

Reply
 
Thread Tools Rate Thread Display Modes
Old 12-26-2004, 06:38 AM   #1
Apoc
Registered User
 
Join Date: Aug 2004
Posts: 25
Default How do you make global functions?

Ok, you know how theres _global to call variables gobally i'd like to know how to create a global function which all my objects will run off. I have no idea how I'll go about doing this so if you can give me a template to run off it will really make my day.

Thanks & Seasons Greetings!
Apoc is offline   Reply With Quote
Old 12-26-2004, 09:45 AM   #2
Laguana
Well known nobody
 
Join Date: Jul 2004
Location: Australia
Posts: 818
Default

I haven't tried it myself, but you might want to try something like _global.myFunction = function() {...} or function _global.myFunction {...}
Laguana is offline   Reply With Quote
Old 12-26-2004, 12:01 PM   #3
til
Registered User
 
til's Avatar
 
Join Date: Oct 2004
Location: Dorset, UK
Posts: 424
Send a message via MSN to til
Default

or you can do, _root.myFunction()
if its on the root path for instance
til is offline   Reply With Quote
Old 12-27-2004, 02:05 AM   #4
pom
Allez les Bleus!!!
 
pom's Avatar
 
Join Date: Oct 2002
Location: Paname
Posts: 2,495
Default

_global.yourFunction = function () {} ;
should do the trick, but you could also add that function to the methods of your class. If you're handling mcs, you could go:
MovieClip.prototype.yourFunction = function () {} ;
and then call yourMc.yourFunction () ;
pom is offline   Reply With Quote
Old 12-27-2004, 02:12 PM   #5
billstoudt
ActionScript Oracle
 
Join Date: Nov 2004
Location: OC SoCal
Posts: 241
Send a message via AIM to billstoudt
Default

pom is right _global.yourFunction = function () {} . i perfer to use this method instead of _root.yourFunction = function () {} because if you are loading movies into levels the _root will not be consistant.

just my 2 cents.
billstoudt is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

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

Forum Jump


All times are GMT. The time now is 05:42 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.