Re: [flexcoders] getDefinitionByName and gotoAndPlay
That's close to the truth, I think. As a colleague of mine pointed out, objects on frame1 were already initialized before the constructor is executed while objects on another frame need some time (usually 1 frame) to become initialized as well. So my solution will be to avoid gotoAndStops as much I can and work with single frame symbols. Matthias 2007/11/21, Alex Harui [EMAIL PROTECTED]: I'm pretty sure that gotoandplay just advances the playhead and doesn't execute the script on that frame until your script finishes so the widgets it creates won't be ready right after the call. -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Matthias Dittgen *Sent:* Wednesday, November 21, 2007 8:13 AM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] getDefinitionByName and gotoAndPlay Hello, I am loading a SWF into my application, which I created in FlashCS3. I have exported MovieClips with timeline animation and textfield, etc. for AS in my library. After loading of the SWF is complete I get the Class like this: var MyClass:Class = getDefinitionByName(MyClass) as Class; Then I create a MovieClip instance an add it to stage, like this: var mc:MovieClip = new MyClass() as MovieClip; addChild(mc); this works great, but when I want to gotoAndPlay() to another frame an change the content of a Textfield there, then the Textfield is null and it takes some time (Timer or Enterframe script) to wait for the Textfield being not null. Can someone imagine why? Matthias
[flexcoders] getDefinitionByName and gotoAndPlay
Hello, I am loading a SWF into my application, which I created in FlashCS3. I have exported MovieClips with timeline animation and textfield, etc. for AS in my library. After loading of the SWF is complete I get the Class like this: var MyClass:Class = getDefinitionByName(MyClass) as Class; Then I create a MovieClip instance an add it to stage, like this: var mc:MovieClip = new MyClass() as MovieClip; addChild(mc); this works great, but when I want to gotoAndPlay() to another frame an change the content of a Textfield there, then the Textfield is null and it takes some time (Timer or Enterframe script) to wait for the Textfield being not null. Can someone imagine why? Matthias
RE: [flexcoders] getDefinitionByName and gotoAndPlay
I'm pretty sure that gotoandplay just advances the playhead and doesn't execute the script on that frame until your script finishes so the widgets it creates won't be ready right after the call. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Matthias Dittgen Sent: Wednesday, November 21, 2007 8:13 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] getDefinitionByName and gotoAndPlay Hello, I am loading a SWF into my application, which I created in FlashCS3. I have exported MovieClips with timeline animation and textfield, etc. for AS in my library. After loading of the SWF is complete I get the Class like this: var MyClass:Class = getDefinitionByName(MyClass) as Class; Then I create a MovieClip instance an add it to stage, like this: var mc:MovieClip = new MyClass() as MovieClip; addChild(mc); this works great, but when I want to gotoAndPlay() to another frame an change the content of a Textfield there, then the Textfield is null and it takes some time (Timer or Enterframe script) to wait for the Textfield being not null. Can someone imagine why? Matthias
[flexcoders] getDefinitionByName and Databinding
Hello there and happy New Year, I'm having problems with dynamic instances and databinding. Here a little example: ExtLabel.mxml ?xml version=1.0 encoding=utf-8? mx:Label xmlns:mx=http://www.adobe.com/2006/mxml; text={this.name} /mx:Label That is just a simple Label-Component printing out its name. If I now initialize that label in my main.mxml everything works fine: main.mxml ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute applicationComplete=init() mx:Script ![CDATA[ import Test.ExtLabel; public function init():void { var label:Object = new ExtLabel(); addChild(DisplayObject(label)); } ]] /mx:Script /mx:Application But if I use getDefinitionByName to dynamically create an instance of ExtLabel I get a Null-reference exception: main.mxml ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute applicationComplete=init() mx:Script ![CDATA[ public function init():void { var labelClass:Class = flash.utils.getDefinitionByName(Test.ExtLabel) as Class; var label:Object = new labelClass(); addChild(DisplayObject(label)); } ]] /mx:Script /mx:Application I'm using the compiler directive --includes to include the class so that's not the problem. The problem seems to be the databinding text={this.name}. If I get rid of it, everything works fine. The error I receive (sorry it's in german): TypeError: Error #1009: Der Zugriff auf eine Eigenschaft oder eine Methode eines null-Objektverweises ist nicht möglich. at Test::ExtLabel/initialize() at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAd\ ded() at mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdde\ d() at mx.core::Container/addChildAt() at mx.core::Container/addChild() at main/init() at main/___Application1_applicationComplete() at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven\ tFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.managers::SystemManager/::preloader_preloaderDoneHandler() at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven\ tFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.preloaders::Preloader/::displayClassCompleteHandler() at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven\ tFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.preloaders::DownloadProgressBar/::timerHandler() at mx.preloaders::DownloadProgressBar/::initCompleteHandler() at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven\ tFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.preloaders::Preloader/::dispatchAppEndEvent() at mx.preloaders::Preloader/::appCreationCompleteHandler() at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven\ tFunction() at flash.events::EventDispatcher/dispatchEvent() Thanks for your help! Bastian
[flexcoders] getDefinitionByName
Im using the method getDefinitionByName so I can get instances of classes which I only know their name. Now, this classes always receive 2 parameters in their constructor. My question would be, how can I pass these parameters using the method getDefinitionByName, somehing like: var name:String = Daniel; var nickname:String = danboh; var ClassName:String = AddClient var ClassReference : Class = getDefinitionByName(com.client.+ClassName) as Class; var instance : Object = new ClassReference(name, nickname); Any suggestions??? Thanks for your help!
[flexcoders] getDefinitionByName(): Variable ... is not defined.
Hello List; I'm trying to create an interface where a user's selection in a menu component results in other components being created. Right now I'm just prototyping, and experimenting with different ways I might do this. One way I've thought of is to use an XML data provider for the list where an attribute of each menu entry describes a class that should be instantiated when that item is selected. e.g. menu item label=classOne childClass=com.Kodak.Galiano.Test.classOne/ I'm running into a problem, though. Because classOne is never actually used in the source code, classOne is not being compiled and linked into the application. When I call getDefinitionByName ( com.Kodak.Galiano.Test.classOne ), there is an error: Variable classOne is not defined. Is there some trick I can use to force classOne to be compiled and linked into the application? Right now my solution is to add a private function that defines a local variable of the appropriate type. private function TrickCompiler() : void { var x : classOne; } This does the trick, but it sure seems hacky. Thanks. Tobias. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
RE: [flexcoders] getDefinitionByName
getDefinitionByName() works on Flex classes as well as Flash ones, but if you want something like getDefinitionByName(mx.controls.Button) to work, you have to ensure that Flex's Button class is linked into your application's SWF. If you actually use the Button class somewhere, it will be. By contrast, the Flash classes are built into the Player and don't need to be used in the SWF. Sorry for the late reply. I'm going through the 1700 posts to flexcoders while I was on vacation, and I didn't see a reply to this one. - Gordon From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Daniel Freiman Sent: Tuesday, September 05, 2006 7:50 AM To: flexcoders Subject: [flexcoders] getDefinitionByName I want to use getDefinitionByName in the flash.utils package to get a class by it's name. I've tried the example in the language reference using Sprite and that works fine but when I use flex classes it doesn't seem to work (I've tried classes I've made and mx.controls.ComboBox). Is there a limitation of this function that I'm missing? Dan __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Software development tool Software development Software development services Home design software Software development company Your email settings: Individual Email|Traditional Change settings via the Web (Yahoo! ID required) Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe __,_._,___
RE: [flexcoders] getDefinitionByName
You need to make sure that the class gets linked into your SWF. You dont need to instantiate it but you need to declare a variable with the type of the class that you want. You can also use the include-classes directive to the compiler to force the class to be available. Check the docs for more details. Matt From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Daniel Freiman Sent: Friday, September 15, 2006 12:27 PM To: flexcoders Subject: [flexcoders] getDefinitionByName I've been using getDefinitionByName to load classes dynamically, however if the class hasn't been previously instantiated it gives me ReferenceError: Error #1065: Variable classname is not defined. Is there any way to fix this other than instantiating every class I might want to use with getDefinitionByName? __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Software development tool Software development Software development services Home design software Software development company Your email settings: Individual Email|Traditional Change settings via the Web (Yahoo! ID required) Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe __,_._,___
[flexcoders] getDefinitionByName
I've been using getDefinitionByName to load classes dynamically, however if the class hasn't been previously instantiated it gives meReferenceError: Error #1065: Variable classname is not defined.Is there any way to fix this other than instantiating every class I might want to use with getDefinitionByName? __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Software development tool Software development Software development services Home design software Software development company Your email settings: Individual Email|Traditional Change settings via the Web (Yahoo! ID required) Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe __,_._,___
[flexcoders] getDefinitionByName
I want to use getDefinitionByName in the flash.utils package to get a class by it's name. I've tried the example in the language reference using Sprite and that works fine but when I use flex classes it doesn't seem to work (I've tried classes I've made and mx.controls.ComboBox). Is there a limitation of this function that I'm missing?Dan __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Software development tool Software development Software development services Home design software Software development company YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___