Button Component Event Listeners
We have begun developing a component based eLearning
template, One of our developers (who isn't component friendly)
wants to add mouse over events to the Button component (I think
they are just being difficult). I don't see where this can be done,
but I hate to say no. Any suggestions? Even a definite yes or no
will help.
We are working on Flash 8, and are currently limited to
developing for player 6 ( I know, it sucks).
rritchey, the rollOver event does not work. Your earlier
solution works in the standard button component, only the rollover
state breaks, the the down and up states still work. In my custom
button all states break. So I consider this a half fix.
dzedward, thanks for the definite nyet. Otherwise I would
obsess over this thing even though it is something we plan not to
do, I just want to be sure before I say can't and won't.
Thanks y'all.
Similar Messages
-
I have come across a problem with the Director documentation
(there's a shocker eh?) regarding Button component events that may
be causing some confusion.
In the events section for the Button, it lists Button.click
as the triggered event. This is in fact incorrect and it is
"onRelease" that gets triggered when this button is pressed. Here
is a sample snippet to help people on their way...Although the documentation is atrocious, and your
"workaround" might
work, it is unnecessary. If the member.eventPassMode =
#passNever
(default) then you can attach a behavior to the sprite that
implements
an "on click" handler and this will fire:
on click me
put "mouseUp"
end -
How to make all Button component instances trigger rollOver sound?
Hello all--
I am using the Button component (the one shipped with CS3) in
many places in my AS3 project. I am coding in .as files, not on the
timeline.
I have skinned the Button to use the colors I like. Now I
wish to "skin" it so that all instances generate a rollOver sound,
and I'll be darned if I can figure out how.
I know I can listen for ROLL_OVER events in each Button
instance. But I have many many Buttons and it seems kludgy to add
that same code to every class I have which tracks a Button. I am
hoping there is some way I can make *all* instances of Button
respond to rollOver the same way. I am hoping it is like
setComponentStyle or changing the skin for the Button; I can do it
in one place and it works everywhere.
I guess I can listen on the Stage level for bubble-ups of
ROLL_OVER, trap those that come from Button instances, and handle
it from there, but stagewide listeners also seem a tad kludgy.
Is there some elegant way to make all my Buttons
automagically generate the same rollOver sound?
Many thanks,
Matthew FordIt's regrettable there is no reply. But in case someone comes
across this topic, FYI I put on my main View class (to which all
other views and GUI are childed) an
addEventListener(MouseEvent.MOUSE_OVER...). The MOUSE_OVER events
bubble up to that.
Then in the listener function I see if the event.target is
Button. If it is, I trigger the sound.
Curiously, the supposedly better ROLL_OVER event did not
bubble up predictably. Sometimes it did and sometimes it did not.
But the docs say that event is not supposed to bubble for some
reason.
I still think there is a better way and I'd like to hear it.
Maybe I just need to make my own clone and adaptation of the
Button, but I am not experienced yet with creating components
(SWCs) and it appears that simply overriding the Button class with
my own .as file does not work-- the rollOver functions report
errors that they cannot be overridden. -
How to block execution of event listeners
Hi all,
JDev version : 11.1.1.6
My requirement is that I want to block all event listeners like ActionListeners, SelectionListeners, DisclosureListeners, RowDisclosure listeners when the screen is opened in readonly mode.
I could block ActionListeners by disabling command links and command buttons etc.
But there's no way to block SelectionListeners, DisclosureListeners, RowDisclosure listeners.
So Is there any common code which can block all listeners?
Or is there any EventController or something like that which will allow me to control event execution?I would have if it was just one screen.
There are hundreds of screens.
Anyways, can't I use any javascript to do this? There are some interfaces like EventListeners , classes like EventConsumer etc. Do none of them provide feature to block event listeners? -
Hi Everyone..
I am getting an Error 1046: Type was not found or was not a compile-time constant: Component Event.
The ComponentEvent class has been imported,and also the event handling code is there. I am not sure what else is wrong, hope somebody can advise me. Thanks. The code is below, the point where the error occurs as indicated by the compiler has been highlighted.
package
import flash.display.Sprite;
import flash.media.Camera;
import flash.media.Microphone;
import flash.media.Video;
import fl.controls.TextArea;
import fl.controls.Button;
import fl.controls.TextInput;
import flash.events.SyncEvent;
import flash.events.MouseEvent;
import flash.events.FocusEvent;
import flash.net.SharedObject;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.events.NetStatusEvent;
import flash.events.FocusEvent;
import flash.events.ComponentEvent;
public class VideoChat extends Sprite
private var button:Button;
private var text_so:SharedObject;
private var textArea:TextArea;
private var textInput:TextInput;
private var chatName:TextInput;
private var nc:NetConnection;
private var nsOut:NetStream;
private var nsIn:NetStream;
private var rtmpNow:String;
private var msg:Boolean;
private var cam:Camera;
private var mic:Microphone;
private var vid:Video;
public function VideoChat ()
//Set up UI
textArea = new TextArea();
textArea.setSize(500,280);
textArea.move(20,54);
addChild(textArea);
textInput = new TextInput();
textInput.setSize(500,24);
textInput.move(20,340);
textInput.addEventListener(ComponentEvent.ENTER,checkKey);
addChild(textInput);
button = new Button();
button.width=50;
button.label="Send";
button.move(20,370);
button.addEventListener(MouseEvent.CLICK, sendMsg);
addChild(button);
chatName = new TextInput;
chatName.setSize (100,24);
chatName.move (80,370);
chatName.text="<Enter Name>";
chatName.addEventListener (FocusEvent.FOCUS_IN, cleanName);
addChild(chatName);
//Connect
rtmpNow="rtmp:/VideoChat ";
nc=new NetConnection;
nc.connect (rtmpNow);
nc.addEventListener(NetStatusEvent.NET_STATUS,doSO);
cam = Camera.getCamera();
mic=Microphone.getMicrophone();
//Camera Settings
cam.setKeyFrameInterval(15);
cam.setMode (240, 180, 15, false);
cam.setMotionLevel(35,3000);
cam.setQuality(40000 / 8,0);
//Microphone Settings
mic.gain = 85;
mic.rate=11;
mic.setSilenceLevel (25,1000);
mic.setUseEchoSuppression (true);
//Video Setup
vid=new Video(cam.width, cam.height);
addChild (vid);
vid.x=10, vid.y=20;
//Attach local video and camera
vid.attachCamera(cam);
private function doSO(e:NetStatusEvent):void
good=e.info.code == "NetConnection.Connect.Success";
if(good)
//Set up shared object
text_so=SharedObject.getRemote("test", nc.uri, false);
text_so.connect (nc);
text_so.addEventListener(SyncEvent.SYNC, checkSO);
private function checkSO(e:SyncEvent):void
for (var chung:uint; change<e.changeList.length; chng++)
switch(e.chageList[chng].code)
case "clear":
break;
case "success":
break;
case "change":
textArea.appendText (text_so.data.msg + "\n");
break;
private function cleanName(e:FocusEvent): void
chatName.text="";
private function sendMsg(e:MouseEvent):void
noName=(chatName.text=="<Enter Name>" || chatName.text=="");
if (noName)
textArea.appendText("You must enter your name \n");
else
text_so.setProperty("msg", chatName.text +": " + textInput.text);
textArea.appendText (chatName.text +": "+textInput.text +"\n");
textInput.text="";
private function checkKey (e:ComponentEvent):void
noName=(chatName.text=="<Enter Name>" || chatName.text=="");
if (noName)
textArea.appendText("You must enter your name \n");
else
text_so.setProperty("msg", chatName.text +": " + textInput.text);
textArea.appendText (chatName.text +": "+textInput.text +"\n");
textInput.text="";
//Create NetStream instances
private function checkConnect (e:NetStatusEvent):void
msg=e.info.code == "NetConnection.Connect.Success";
if(msg)
nsOut=new NetStream(nc);
nsIn=new NetStream(nc);
//NetStream
nsOut.attachAudio(mic);
nsOut.attachCamera(cam);
nsOut.publish("camstream");
nsIn.play("camstream");Hi Guys...
I have found out what is wrong. I was importing the wrong package the correct one should have been:
import fl.events.ComponentEvent;
instead of
import flash.events.ComponentEvent;
I hope this is helpful for anyone caught in a simillar situation as me...Thanks.. -
Using Multiple Event Listeners
Hi,
I have a movielcip (A) class in which I have used a Tween class effect on a child movieclip (B) scrollRect. The (B) Movieclip in turn has several movieclips whose have tween class effect being executed on thier child movieclips.
the tweens are all unique to each movieclip
and the event listeners are taken off once completed.
This works all well and good in FLASH IDE...
My problem arises when I try to view this in a browser on a Windows XP
it doesnt work in
Opera Version 9.63
Firefox 2.0
and Google Chrome 2.0
The only browser it works fluently in is
Internet Explorer 7.0.5
What is happening in most cases it that the animation appears to "stick" but i think what may be happening is the listening or removal of the event listeners. The animations are left incompleted.
Is there any rule of thumb when using multiple event listeners?
here is a snippet of some of my code
on click event from movieclip (A)
private function scrollToSlidePrev(e:MouseEvent) {
if (((slideIndex - 1) >= 0)) {
nextButton.mouseEnabled = nextButton.enabled = previousButton.enabled = previousButton.mouseEnabled = false;
var position:Number = 0-SLIDEAREA.width;
var slide1:TileListSlide = slides[slideIndex] as TileListSlide;
var slide2:TileListSlide = slides[--slideIndex] as TileListSlide;
scrollSlide(position,slide1,slide2);
tween animation in movieclip (A) on (B)
private function scrollSlide(pos:int,slide1:TileListSlide,slide2:TileListSlide) {
slide1.resizeSlideTo(0.6); // execute tween on child movie clips in B
slide2.resizeSlideTo(1); // same as above;
var rect:Rectangle = sliderMc.scrollRect;
var tween1:Tween = new Tween(rect,"x",Regular.easeOut,rect.x,rect.x + pos,3,true);
tween1.addEventListener(TweenEvent.MOTION_CHANGE,setSliderScroll,false,4);
tween1.addEventListener(TweenEvent.MOTION_FINISH,toggleButtonEnabled,false,3);
tween animation in movieclip (B) children
public function resizeSlideTo(sc) {
var m:Matrix = tileList.transform.matrix as Matrix;
var p:Point = new Point (m.a, 0);
var tween2:Tween = new Tween(p,"x",Regular.easeOut,p.x,sc,3,true);
if (numericStepper != null) {
if (sc != 1) {
numericStepper.visible = false;
tween2.removeEventListener(TweenEvent.MOTION_FINISH,showStepper);
if (sc === 1) {
tween2.addEventListener(TweenEvent.MOTION_FINISH,showStepper,false,2);
tween2.addEventListener(TweenEvent.MOTION_CHANGE,setScaleOnScroll,false,3);
here is the link
http://visual_admin.web.aplus.net/ticker/ticker_widget.html
the effect disables and re-enables the buttons when its done.... then the listeners are removed.
each one with the exception cretes its own unique tween (obviously this is a custom class built as each clip)
i really don't know what to make of it guysapparantly making the tween a property of the class rather than a random variable in a function worked.....go figure
-
Changing The Text Color In a Radio Button Component
Hi,
I'm using a background in my frame , so I need to know how
to change the color of the Radio Button Component. I tried using
the Property Inspector , but in that the color option is disabled.
The Flash version I'm using is Flash 8. Kindly provide me a
solution for this.
Thanks In Advance,
Lokesh RThere's a topic about this in the Flash help, about changing
components. You need to edit the file inside your Flash
installation folder, and make a copy of it to your liking.
But about radio buttons: is there any way to include them in
your project while maintaining the possibility of on(Keypress)
events? -
Loading/Unloading a .swf that adds event listeners to the Stage
Hi all,
Disclaimer
Apologies if I suck so bad at using forum search that the answer to this is on page 1 somewhere; I tried...
Question
I am loading and unloading a .swf to which I do not have source code access. This .swf places several event listeners on the stage, as far as I can tell. When the .swf is unloaded, the event listeners placed upon the stage still seem to be in effect. Using unloadAndStop doesn't seem to do it, and I have to target Flash Player 9, anyway, so can't really use it. Is there any other way I can keep this external .swf from holding onto my main movie's stage?
Additional info
All eventListeners and references being set by my code are removed.
I've managed a little contact with the author of the .swf:
I've requested he provide a dispose() method I can call to get all the listeners removed, and send an updated .swf.
He's suggested that I should be able to avoid the problem by loading into a unique ApplicationDomain. I'm not terribly familiar with this, but have given it a try without much success. Is this a valid solution - can I really protect my 'stage' by properly using ApplicationDomains - or do I need to persist in trying to get a public dispose() method built in?
Thanks in advance!
Cheers, Johnthanks for reply sir
sir actually, i have not any problem with loading any file but i need to go back to intro.swf file when i click on clsbtn of main.swf, i want unload the main.swf file and panel.swf file
actually i did was, i have intro.swf file and there is button by clicking load main.swf file (where is timeline controling butons) and in the main file automatically load panel.swf file ( where is all animation)
its all play gud , no problem
but my problem is there is a clsbtn in main.swf file and when i click on that button everything should be unload and it should return on the previous position in intro.swf
i hope u understand what i am trying to say -
Managing various event listeners in multi-frame movie
I'm working on a gunslinger game. I have numerous frames
which correspond to different stages of the game. The frame that
corresponds to the actual gameplay has a really involved
ENTER_FRAME function attached to particular item on the stage. When
the game is over (or an error occurs, or the network connection
fails) I want to leave the gameplay frame and move to some other
frame. When this happens, I would like the ENTER_FRAME function on
the gunslinger to be removed because the player may finish a game
and then re-enter the gameplay frame later after selecting a new
opponent.
QUESTION: Can anyone recommend a good way to manage the
keyboard event listeners, all the button event listeners, etc? As
you might imagine, I have no reliable way to determine which frame
might be entered after the gameplay frame because the frame change
could be triggered by a variety of different reasons.I have tried using hasEventListener to check for an existing
ENTER_FRAME function before adding the event listener again but it
never seems to notice that there is an existing enterframe function
running. Furthermore, when I leave the frame, the enterframe
function (which is attached to a particular movie clip on frame 2)
continues to run even though that movie clip doesn't exist on any
other frame in the flash movie.
The first frame in my movie just has a button that takes the
movie to frame 2. frame 2 has a movie clip (myMovie) and a button
(btnFrame1) which goes back to frame 1. It also has the attached
actionscript.
I start the movie.
I click 'goto frame 2'
the enterframe listener is added and starts to output trace
statements of the current frame of myMovie (e.g., 1-2-3).
i click 'goto frame 1' on the main movie
although i am looking at frame 1 of my main movie which has
no instance of myMovie, the enterframe function keeps tracing the
current frame--interestingly, the frame of myMovie does not
advance...it stays on 1, 2, or 3 and announces that frame over and
over again.
Repeating the visit to frame 1 and frame2 over and over again
results in more listeners being added over and over again.
I have uploaded a sample FLA here:
http://jaith.net/questions/listenerExample.zip
I hope that you might help me determine how to remove the
listener upon exiting this frame. I don't want that enterframe
function running (and referring to movieclips that don't exist)
when I exit the frame where it is relevant. I'm wondering if I
should try adding the event listener to the root movie
instead. -
Moving buttons and their listeners to separate classes
Hi
I am trying to move out buttons and their listeners to separate classes, but when I do so, the program stops working. When I click on the button they dont react, probably the listeners doesent listens as the action performe prints out testprints.
In other words, I have huge troubles with do my gui object oriented. I doesent seem to be able to move out relevant listener methods and their components to separate classes.
Here is the code for one add button that I have tried to write in a separate class:
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import se.cs.DB.DBMovie;
import se.cs.inputvalidation.PatternsMovie;
import se.cs.main.Main;
import se.cs.main.MessageArea;
public class ButtonAddMovie {
private DBMovie init = new DBMovie();
private ComboBoxesMovie comboBoxesMovie = new ComboBoxesMovie();
private TextFieldsMovie textFieldsMovie = new TextFieldsMovie();
private PatternsMovie patternsMovie = new PatternsMovie();
private MessageArea messageArea = new MessageArea();
private Pattern patternYear;
private Pattern patternSection;
private Pattern patternExFields;
private Matcher matcherYear;
private Matcher matcherSection;
private Matcher matcherTotalEx;
private Matcher matcherExIn;
private Matcher matcherExOut;
private String genreString;
// Initializes the button components
private JButton addButton = new JButton("Add");
public ButtonAddMovie() {
listener();
public void listener() {
addButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
addButton(e);
public void addButton(ActionEvent e) {
genreString = comboBoxesMovie.convertGenreIndex();
regex();
public void regex() {
patternYear = Pattern.compile(patternsMovie.getYEAR_FIELD());
patternSection = Pattern.compile(patternsMovie.getSECTION_FIELD());
patternExFields = Pattern.compile(patternsMovie.getExFields());
matcherYear = patternYear.matcher(textFieldsMovie.getTextYear());
matcherSection = patternSection.matcher(textFieldsMovie.getTextYear());
matcherTotalEx = patternExFields.matcher(textFieldsMovie
.getTextTotalEx());
matcherExIn = patternExFields.matcher(textFieldsMovie.getTextExIn());
matcherExOut = patternExFields.matcher(textFieldsMovie.getTextExOut());
if (matcherYear.matches() && matcherSection.matches()
&& matcherTotalEx.matches() && matcherExIn.matches()
&& matcherExOut.matches()) {
messageArea.getMessageArea().setText("");
callInsertStatement();
JOptionPane.showMessageDialog(null, this.messageDialog(),
"Movie added", JOptionPane.INFORMATION_MESSAGE);
else if (!matcherYear.matches()) {
messageArea.getMessageArea().setText(
"The input for year field does not match.\n"
+ "You have to enter 4 digits.");
else if (!matcherSection.matches()) {
messageArea.getMessageArea().setText(
"The input for section field does not match.\n"
+ "You have to enter 1-4 digits.");
else if (!matcherTotalEx.matches()) {
messageArea.getMessageArea().setText(
"The input for total ex field does not match.\n"
+ "You have to enter 1.");
else if (!matcherExIn.matches()) {
messageArea.getMessageArea().setText(
"The input for ex in does not match.\n"
+ "You have to enter 1 digit.");
else if (!matcherExOut.matches()) {
messageArea.getMessageArea().setText(
"The input for ex out does not match.\n"
+ "You have to enter 1 digits.");
public void callInsertStatement() {
try {
init.insertStatement(textFieldsMovie.getTextTitle(),
textFieldsMovie.getTextYear(), genreString, comboBoxesMovie
.convertGradeIndex(), textFieldsMovie
.getTextSection(),
textFieldsMovie.getTextTotalEx(), textFieldsMovie
.getTextExIn(), textFieldsMovie.getTextExOut());
} catch (SQLException ex) {
ex.printStackTrace();
public String messageDialog() {
int grade = comboBoxesMovie.getGradeBox().getSelectedIndex() + 1;
String title = textFieldsMovie.getTitleField().getText();
String year = textFieldsMovie.getYearField().getText();
String section = textFieldsMovie.getSectionField().getText();
String totalEx = textFieldsMovie.getTotalExField().getText();
String exIn = textFieldsMovie.getExInField().getText();
String exOut = textFieldsMovie.getExOutField().getText();
return "\n" + "Title: " + title + "\n" + "Year: " + year + "\n"
+ "Genre: " + comboBoxesMovie.convertGenreIndex() + "\n"
+ "Grade: " + grade + "\n" + "Section: " + section + "\n"
+ "Total ex.: " + totalEx + "\n" + "Ex. in: " + exIn + "\n"
+ "Ex. out: " + exOut + "\n";
* Gets the addButton
* @return addButton
public JButton getAddButton() {
return addButton;
}I said "don't" cross-post and that the discussion has already been started in the "New To Java" forum.
If you have two discussions going on then people waste time answering because they don't know what has already been suggested. -
Create generic event listeners
I am trying to create generic event listeners {That should respond to mouse click, keyboard whether it happens on a frame, menus or command line }.
Is it possible??It is not strictly speaking a listener, but you could override Component.dispatchEvent() to capture all events in one place.
-
IOS Home Button and Event.ACTIVATE/Event.DEACTIVATE
Hi all,
I read tons of questions re iOS Home Button and Event.ACTIVATE/Event.DEACTIVATE. Everything should work well if you set the proper listeners and save/restore your app state upon receiveing these events.
My question is: Is there a way to tell difference between a Home Button press and an iOS notification alert or incomming call? In both cases, AIR will dispatch Event.DEACTIVATE, however I want to know if the user pressed the Home Button or if he just received an SMS/Calendar alert, and adapt my app state accordingly - i.e. if it's a Home Button press, change my app state to "Main Menu", otherwise (SMS/Calendar/alert) I will pause execution.
NOTE: I don't want to override the Home Button behaviour, just want to tell if it's a Home Button press or SMS/Calendar/alert, and react accordingly. The iOS documentation states that in case of SMS/Calendar/alerts, (void)applicationWillResignActive:(UIApplication *)application is dispatched, and in case of actually going to background state (i.e. Home Button pressed) (void)applicationDidEnterBackground:(UIApplication *)application is dispatched.
ThanksAny luck with this yet? I'm having the exact same issues but on a different device, the Kindle Fire.
I need to determine whether a user hit the Home button, or hit the Quick Settings button (that accesses controls like volume). Air treats both events equally by broadcasting Event.DEACTIVATE. Unfortunately, the Amazon Appstore approval team thinks otherwise...
It seems like there should be a simple, no-brainer way to track these events, but I'm beginning to suspect Air just is not capable. In that case, if you're developing for Kindle Fire, you may want to avoid going with Adobe. -
Error with No Message on Button Click Event
Hi,
I am getting a framework error on button click event.
I have a page in which shuttle component is there,on click of the commit button the page traversed to main jsp page there i am getting error like ERROR and only '-'.
In application module java file i have written the code for the shuttle component which creates the new row and set the values.Hi Frank. Thanks for the answer. Kindly check the code for shuttle component below. This is written in the Application Module (..ServicesImpl.java)
public void multipleShuttle(List productIds,String reqRefNumber,Date orderDate,String hoSectionCd)
System.out.println("Its entering into the test method");
System.out.println("Inside updateSkillsForCurrentStaff method");
System.out.println("reqRefNumber:"+reqRefNumber);
System.out.println("orderDate:"+orderDate);
System.out.println("hoSectionCd:"+hoSectionCd);
if (productIds != null && productIds.size() > 0)
List<Number> copyOfProductIds = (List<Number>)Utils.cloneList(productIds);
//List copyOfProductIdsNames=Utils.cloneList(productIds);
System.out.println("list values "+copyOfProductIds);;
//System.out.println("list values "+copyOfProductIdsNames);;
ViewObject skills = getMsMsOrderHdrUO2();
RowSetIterator rsi = skills.createRowSetIterator(null);
// remove any rows for the current user that aren't in the list of product keys
while (rsi.hasNext())
Row r = rsi.next();
Number productId = (Number)r.getAttribute("MsDepotCd");
System.out.println("depot from row setter "+productId);
// if the existing row is in the list, we're ok, so remove from list.
if (copyOfProductIds.contains(productId))
copyOfProductIds.remove(productId);
// if the existing row is in not list, remove it.
else {
r.remove();
rsi.closeRowSetIterator();
// at this point, we need to add new rows for the keys that are left
for (Number productIdToAdd: copyOfProductIds)
Row newRow = skills.createRow();
skills.insertRow(newRow);
try
System.out.println("productIdToAdd"+productIdToAdd);
System.out.println("inside attributes setter try method");
//AS PER THE NEW REQUIREMENT ORDER STAUTS WIL BE 'DRAFT' AND ON APPROVAL BY JGM THEN IT WILL BE 'APPROVED'
newRow.setAttribute("OrderStatus","DRAFT");
System.out.println("Depot Code set is"+newRow.getAttribute("DepotCd"));
if(productIdToAdd.equals("0"))
System.out.println("inside the HO method to set section");
newRow.setAttribute("HoSections",hoSectionCd);
System.out.println("After setting the values");
catch(Exception e)
System.out.println("Exception Caught"+e);
getDBTransaction().commit();
orderDetailInsertProcedure(reqRefNumber);
} -
Flash 8 asset Xtra update - component event workaround
Sorry to post so much about this. Lots of us are having major
headaches because after the Flash 8 asset Xtra update Flash
component events in Director don't behave as they once did.
BUT I've discovered you can use a combination of
addEventListener() and setCallback() to respond to events, at least
with the button component. Fortunately this works with the new
Shockwave player too. It’s a little convoluted, but at least
clicking a button makes stuff happen now.
It’s easier to let you look at it yourself than try to
explain it, I’m getting brain dead from experimenting with
this all evening. Click
HERE
to download the zip file.
Please look through the code and see if you can come up with
anything else to add. Hopefully smarter folks than me will be able
to work more of this out. It doesn’t seem like we’re
getting any help from Adobe on this. I posted a question on Tom
Higgins’ blog today and got an auto response saying
he’s on vacation until April 24 and won’t be checking
email. He’s usually good about communicating with developers
about Director, so with luck he’ll be able to help out.
Optimally they’ll fix the durn thing. If you have time please
post anything you discover regarding components after installing
the new asset Xtra.I had a look at your file, and I noticed:
function buttonClick(me,passedObj)
// unfortunately this don't work
for (var objProps in passedObj)
ember("infoText").text += objProps;
two things:
First, I think what you're trying (getting info on the object
properties) might only work in lingo.
on buttonClick(me,passedObj,eventObj)
--put a break point in here, and inspect the objects
member("infoText").text = "label property: " &
eventObj.target.label
member("infoText").text = member("infoText").text &
RETURN & "toggle property: " & eventObj.target.toggle
end
Second, I was playing with this, and discovered through the
function's (undocumented) arguments array that the third argument
is the event object which is another place to test for variables.
An event object has a 'type' property (in this case "click"), and a
'target' property which is the button. Hope this helps! -
How can I execute an external program from within a button's event handler?
I am using Tomcat ApacheTomcat 6.0.16 with Netbeans 6.1 (with the latest JDK/J2EE)
I need to execute external programs from an event handler for a button on a JSF page (the program is compiled, and extremely fast compared both to plain java and especially stored procedures written in SQL).
I tried what I'd do in a standalone program (as shown in the appended code), but it didn't work. Instead I received text saying the program couldn't be found. This error message comes even if I try the Windows command "dir". I thought with 'dir' I'd at least get the contents of the current working directory. :-(
I can probably get by with cgi on Apache's httpd server (or, I understand tomcat supports cgi, but I have yet to get that to work either), but whatever I do I need to be able to do it from within the button's event handler. And if I resort to cgi, I must be able to maintain session jumping from one server to the other and back.
So, then, how can I do this?
Thanks
Ted
NB: The programs that I need to run do NOT take input from the user. Rather, my code in the web application processes user selections from selection controls, and a couple field controls, sanitizes the inoputs and places clean, safe data in a MySQL database, and then the external program I need to run gets safe data from the database, does some heavy duty number crunching, and puts the output data into the database. They are well insulated from mischeif.
NB: In the following array_function_test.pl was placed in the same folder as the web application's jsp pages, (and I'd tried WEB-INF - with the same result), and I DID see the file in the application's war file.
try {
java.lang.ProcessBuilder pn = new java.lang.ProcessBuilder("array_function_test.pl");
//pn.directory(new java.io.File("K:\\work"));
java.lang.Process pr = pn.start();
java.io.BufferedInputStream bis = (java.io.BufferedInputStream)pr.getInputStream();
String tmp = new String("");
byte b[] = new byte[1000];
int i = 0;
while (i != -1) {
bis.read(b);
tmp += new String(b);
getSelectionsDisplayTextArea().setText(getSelectionsDisplayTextArea().getText() + "\n\n" + tmp);
} catch (java.io.IOException ex) {
getSelectionsDisplayTextArea().setText(getSelectionsDisplayTextArea().getText() + "\n\n" + ex.getMessage());
}Hi Fonsi!
One way to execute an external program is to use the System Exec.vi. You find it in the functions pallet under Communication.
/Thomas
Maybe you are looking for
-
How to Execute shell commands in OSB
Team, My Requirement: I have two sftp servers name ServerA and ServerB. Need to copy files from ServerA and place it on ServerB and change the file permissions to 777 after placing the files. The user i am connecting to ServerB has the access to over
-
To make changes in the subject of Email for PO Creation...
Hi , We have done configuration in NACE for simple mail to be sent when a PO is created . i want to change the subject of Email for PO Creation... Please help me in this regards Regards R/Ragu Useful answers will be rewarded
-
ISE 1.2 removing stale/ all sessions
Hi all, does somebody have an idea how to remove stale all sessions from ISE (all nodes)? I have tried to follow the document , but when logging to primary admin node (HA setup,its has all 3 functions: ADM (pri), MNT (pri), PSN) commends recommended
-
Hi, my Exchange Server not work. I need to open my ost file. Is it possible to do this using the Outlook? Files are larger than, which stores a lot of information.
-
Can i delete the "All files" option in FileChooser
How? Thanks...