Custom Widget Events

Create unique Flash widgets you can import into SmartBuilder

Moderator: Nav

Custom Widget Events

Postby VIN_andrew » Fri Jul 06, 2007 9:47 am

I am hoping that I can define my own custom events for a Widget to fire.

In this specific case I'm creating a custom navigation widget that will display different displays in a set based on which "button" is clicked on inside the Widget. So , I want my Widget to fire events such as : "goDisplay1", "goDisplay2", "goDisplay3". (Why a widget? So I can make a template that supports navigating multiple numbers of displays in a set: just set the "number of display" param. Otherwise would need different template for each number of displays).

How would I set this up? The demo widget that comes with the SDK only refers to an "onClick" event.

thanks,
andrew
----------------------------
Andrew Corbett, Ph.D.
Online Multimedia Director
Veterinary Information Network
VIN_andrew
 
Posts: 7
Joined: Tue Apr 03, 2007 8:30 am

Postby VIN_andrew » Fri Jul 06, 2007 10:11 am

Actually, answered my own question through a little experiment.

You register your own events via:
Code: Select all
adapter.registerEvent("onMyCustomEvent");


You fire them wherever you want via:
Code: Select all
adapter.fireEvent("onMyCustomEvent");


Then "onMyCustomEvent" shows up in the list of actions available for the object.

Cool!

andrew
----------------------------
Andrew Corbett, Ph.D.
Online Multimedia Director
Veterinary Information Network
VIN_andrew
 
Posts: 7
Joined: Tue Apr 03, 2007 8:30 am

Re: Custom Widget Events

Postby ScottA » Fri Sep 26, 2008 2:29 pm

I want to find a way to pass data from a widget to the SmartBuilder lesson. I have registered an event and wrote a function that fires the event:

adapter.registerEvent("onDataLoad");
.
.
.
adapter.fireEvent("onDataLoad");

This will fire that event in the SmartBuilder lesson in which I put this widget, and I can have things in the SmartBuilder lesson respond as a result of that. But I also want to be able to send data with this event. At first, I simply want to display this data. I also want to use this data to determine changes in the lesson.

What I am doing is making a widget that gets data from an external database. Once that data is loaded into the Flash widget, I want to send that data to the SmartBuilder lesson too.

How do I do this??

Scott
Scott Allison
Veterinary Information Network
ScottA
 
Posts: 51
Joined: Sat May 26, 2007 4:22 pm
Location: Davis, California

Re: Custom Widget Events

Postby Nav » Mon Sep 29, 2008 2:59 pm

Hi Scott,
What you have to do is register a new method, such as "getData" that you can interact with inside of SmartBuilder. You do this the same way you registered an event, except that it is a method.

- Nav
Nav
 
Posts: 866
Joined: Mon Nov 05, 2007 2:58 pm


Return to Using the Object SDK

Who is online

Users browsing this forum: No registered users and 2 guests

cron
Not able to open ./cache/data_global.php