AE ENHANCERS

Expressions/Scripts/Presets
It is currently Wed Sep 17, 2014 10:38 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Making buttons perform functions
PostPosted: Mon Sep 20, 2010 3:29 pm 
Offline

Joined: Thu Sep 16, 2010 8:13 pm
Posts: 8
I have been making scripts for about 2 weeks, and I have created a script that simply makes a camera rig, and I decided to add a user interface to it so that it looks a little bit more professional. I have been wrestling JavaScript for 2 hours straight, and I can't get the button to do ANYTHING. I have looked at others scripts to see what they did (AE3D Exporter, SkyDome, ect.) and I am still stumped. I have my script up on my Opera Unite server if you want to download it and tell me what I'm doing wrong.
http://secretnetworkc2c.maximumrfan.ope ... e_sharing/
It will be "MRFCameraRig _ User Interface.jsx".
Thanks,
Matthew


Top
 Profile  
 
 Post subject: Re: Making buttons perform functions
PostPosted: Tue Sep 21, 2010 3:41 am 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 697
Location: London, UK
I couldn't access your script, but generally, after defining your UI you would include code like this to call a function when the button is clicked:
Code:
pal.grp.mid.left.preset.deleteButton.onClick = onDeletePresetButton;

Don't put () after the function name or it'll get called when initially defined. Or if you want to create a new specific function for it you could use code like:
Code:
pal.grp.top.progBarBut.buttons.about.onClick = function() {
   if (helpWindow instanceof Window) helpWindow.show();
   else helpWindow();
}

Check out the "Control event-handling callbacks" section of the Javascript Tools Guide pdf.


Top
 Profile  
 
 Post subject: Re: Making buttons perform functions
PostPosted: Tue Sep 21, 2010 1:14 pm 
Offline

Joined: Thu Sep 16, 2010 8:13 pm
Posts: 8
Paul Tuersley wrote:
I couldn't access your script, but generally, after defining your UI you would include code like this to call a function when the button is clicked:
Code:
pal.grp.mid.left.preset.deleteButton.onClick = onDeletePresetButton;

Don't put () after the function name or it'll get called when initially defined. Or if you want to create a new specific function for it you could use code like:
Code:
pal.grp.top.progBarBut.buttons.about.onClick = function() {
   if (helpWindow instanceof Window) helpWindow.show();
   else helpWindow();
}

Check out the "Control event-handling callbacks" section of the Javascript Tools Guide pdf.

Thank you! I finally figured out what I was doing wrong. I uploaded the script I made to MegaUpload.
http://www.megaupload.com/?d=3SVNF4F4
P.S. It's in alpha/beta/whatever-you-call-it phase.
Thanks,
Matthew


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group