Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Extensions and Plugins > Components

Reply
 
Thread Tools Rate Thread Display Modes
Old 08-28-2005, 12:34 PM   #1
Daevid
Registered User
 
Join Date: Aug 2005
Posts: 6
Question onChange event problem with components

I've been trying to declare an onChange-function to a combobox component like this (from an extended movie clip that contains the combobox "Type"):

ActionScript Code:
Type.onChange = function (){ trace ("changed!") }

This works with with onRelease-event for buttons etc, but for some reason flash ignores this function. If I instead attach a similar function directly to the combobox:

ActionScript Code:
on(change) { this.onChange () }

... it sends the event correctly. I can't understand why, and would rather not have any code internally in the fla-file.

Can anybody explain why this is?

/David
Daevid is offline   Reply With Quote
Old 08-28-2005, 12:57 PM   #2
Xeef
Off-Line
 
Xeef's Avatar
 
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
Default

hi and welcome to As.Org

the combobox has NO "onChange"
BUT
Quote:
ComboBox.change
Availability
Flash Player 6 (6.0 79.0).
__________________

test your self -->http://www.actionscript.org/forums/s...86&postcount=8
Xeef is offline   Reply With Quote
Old 08-28-2005, 04:00 PM   #3
Daevid
Registered User
 
Join Date: Aug 2005
Posts: 6
Default

Thanks for both the help and the welcoming! Unfortunatley I can't get it working with the "change" event either:

ActionScript Code:
Type.change = function (){             trace ("changed!")         }

I've tried the more conventional listener syntax aswell, but i guess i'll have to stick to my "ugly" solution.

/David
Daevid is offline   Reply With Quote
Old 08-28-2005, 05:12 PM   #4
Xeef
Off-Line
 
Xeef's Avatar
 
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
Default

ActionScript Code:
listenerObject = new Object(); listenerObject.change = function(eventObject) {     trace("changed!"); }; Type.addEventListener("change", listenerObject);
__________________

test your self -->http://www.actionscript.org/forums/s...86&postcount=8
Xeef is offline   Reply With Quote
Old 08-29-2005, 08:48 AM   #5
Daevid
Registered User
 
Join Date: Aug 2005
Posts: 6
Default

Thanks,

this works if I put the script attached to a movie clip in flash (in a onClipEvent(load)-event), BUT it still doesn't work when I try to attach it through an external .as class (within the MC:s creator function). Is it possible that the change event isn't supported in AS2?

Sorry for being so picky but I try to avoid having scripts inside the fla-file...

I really appreciate you help, though.

/David
Daevid is offline   Reply With Quote
Old 08-29-2005, 10:31 AM   #6
Xeef
Off-Line
 
Xeef's Avatar
 
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
Default

upload the files so i can test
__________________

test your self -->http://www.actionscript.org/forums/s...86&postcount=8
Xeef is offline   Reply With Quote
Old 08-29-2005, 12:00 PM   #7
Daevid
Registered User
 
Join Date: Aug 2005
Posts: 6
Default

Here is a fla and an as file where the problem is isolated. Thanks.

/David
Attached Files
File Type: zip isolatedMC.zip (55.0 KB, 102 views)
Daevid is offline   Reply With Quote
Old 08-29-2005, 01:08 PM   #8
Xeef
Off-Line
 
Xeef's Avatar
 
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
Default

ActionScript Code:
class testMovieClip extends MovieClip {     var type;     var listenerObject = new Object();     function testMovieClip() {         mx.events.EventDispatcher.initialize(type);         listenerObject.change = function(eventObject) {             trace("changed!");         };         type.addEventListener("change", listenerObject);     } }
__________________

test your self -->http://www.actionscript.org/forums/s...86&postcount=8
Xeef is offline   Reply With Quote
Old 08-29-2005, 02:26 PM   #9
Daevid
Registered User
 
Join Date: Aug 2005
Posts: 6
Default

Sorry, still no success. Have you tried the files on your system?

Any clues on why you need to initialize the change-event for comboboxes, when button event work OK without?

Thanks anyhow!

/David
Daevid is offline   Reply With Quote
Old 08-29-2005, 05:42 PM   #10
Xeef
Off-Line
 
Xeef's Avatar
 
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
Default

no i dint test you files because you was uploading an SWF
there you see so or so no traces

i have a slight idea why you need to initialize but

if you realy wana know you need to ask senocular
Attached Files
File Type: zip qqq.zip (86.1 KB, 120 views)
__________________

test your self -->http://www.actionscript.org/forums/s...86&postcount=8
Xeef 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 03:45 PM.

///
Follow actionscriptorg on Twitter

 


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