[Flashcoders] Re: Re: Passing text between SWFs
Thanks for all your help dr.ache. I think I am very close now. I still get a number of errors, but I think the underlying problem is this one: 5000: The class 'RTE2124BuserName' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type. What is that trying to tell me, and how do I fix it? I tried a number of things (even deleting all the Movie Clips from the library), but I still get the same errors. It certainly won't let me put one class in another (as one might interpret the term subclass). When I tried that it told me that classes can't be nested. package { // Import stuff import flash.events.EventDispatcher; import flash.events.Event; import flash.events.MouseEvent; import flash.display.*; import flash.net.URLRequest; import flash.display.Graphics; public class RTE2124BuserName { var rect1:Shape = new Shape(); rect1.graphics.beginFill(0xFF); rect1.graphics.drawRect(0, 0, 1966, 660); rect1.endFill(); addChild(rect1); var ldr1:Loader = new Loader(); ldr1.mask = rect1; var url1:String = topics/rte2124b_topic1.swf; var urlReq1:URLRequest = new URLRequest(url1); ldr1.load(urlReq1); ldr1.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler1); } public function completeHandler1(event:Event):void { MovieClip(event.currentTarget)._parent = this; trace(_parent.ldr1); } } Alan Neilsen This message is for the named persons use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or; lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient. GOULBURN OVENS INSTITUTE OF TAFE and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of any such entity. # This e-mail message has been scanned for Viruses and Content and cleared by MailMarshal # ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Re: Re: Passing text between SWFs
- Original Message - From: Alan Neilsen [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Monday, October 27, 2008 10:13 PM Subject: [Flashcoders] Re: Re: Passing text between SWFs Thanks for all your help dr.ache. I think I am very close now. I still get a number of errors, but I think the underlying problem is this one: 5000: The class 'RTE2124BuserName' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type. What is that trying to tell me, and how do I fix it? I tried a number of things (even deleting all the Movie Clips from the library), but I still get the same errors. It certainly won't let me put one class in another (as one might interpret the term subclass). That's not the correct interpretation of subclass. What it wants is a class that is based on MovieClip, so: public class RTE2124BuserName extends MovieClip { would base your class on MovieClip and then it would be a subclass of MovieClip .. Paul - When I tried that it told me that classes can't be nested. package { // Import stuff import flash.events.EventDispatcher; import flash.events.Event; import flash.events.MouseEvent; import flash.display.*; import flash.net.URLRequest; import flash.display.Graphics; public class RTE2124BuserName { var rect1:Shape = new Shape(); rect1.graphics.beginFill(0xFF); rect1.graphics.drawRect(0, 0, 1966, 660); rect1.endFill(); addChild(rect1); var ldr1:Loader = new Loader(); ldr1.mask = rect1; var url1:String = topics/rte2124b_topic1.swf; var urlReq1:URLRequest = new URLRequest(url1); ldr1.load(urlReq1); ldr1.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler1); } public function completeHandler1(event:Event):void { MovieClip(event.currentTarget)._parent = this; trace(_parent.ldr1); } } Alan Neilsen This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or; lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient. GOULBURN OVENS INSTITUTE OF TAFE and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of any such entity. # This e-mail message has been scanned for Viruses and Content and cleared by MailMarshal # ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Re: Re: Passing text between SWFs
Hi Alan. The missing thing is you must let RTE2124BuserName (one of the most horrible class names I have seen so far :-) ) extend MovieClip. Therefore you have to import the movieclip class How this is accomplished you can see in the text. The errormessage tells you that you linked one of the library symbols with your class - what is ok to do so. In the linkage properties you can define a baseclass for your symbol what you could change to flash.display.Sprite but in your case its not necessary. To delete all your symbols in the library is definitely not a solution ;-) As far as I can tell you this is not the last error you get. I highly recommend to read the manual. Alan Neilsen schrieb: Thanks for all your help dr.ache. I think I am very close now. I still get a number of errors, but I think the underlying problem is this one: 5000: The class 'RTE2124BuserName' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type. What is that trying to tell me, and how do I fix it? I tried a number of things (even deleting all the Movie Clips from the library), but I still get the same errors. It certainly won't let me put one class in another (as one might interpret the term subclass). When I tried that it told me that classes can't be nested. package { // Import stuff here goes: import flash.display.MovieClip; import flash.events.EventDispatcher; import flash.events.Event; import flash.events.MouseEvent; import flash.display.*; import flash.net.URLRequest; import flash.display.Graphics; public class RTE2124BuserName { this one needs to be: public class RTE2124BuserName extends MovieClip var rect1:Shape = new Shape(); rect1.graphics.beginFill(0xFF); rect1.graphics.drawRect(0, 0, 1966, 660); rect1.endFill(); addChild(rect1); var ldr1:Loader = new Loader(); ldr1.mask = rect1; var url1:String = topics/rte2124b_topic1.swf; var urlReq1:URLRequest = new URLRequest(url1); ldr1.load(urlReq1); ldr1.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler1); } public function completeHandler1(event:Event):void { MovieClip(event.currentTarget)._parent = this; trace(_parent.ldr1); } } Alan Neilsen This message is for the named person’s use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or; lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient. GOULBURN OVENS INSTITUTE OF TAFE and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of any such entity. # This e-mail message has been scanned for Viruses and Content and cleared by MailMarshal # ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Re: Re: Passing text between SWFs
Thanks dr.ache I still can't get this to work. Whatever is wrong, it doesn't like the line public function completeHandler(event:Event) {. I get Type was not found or was not a compile-time constant: Event I tried adding import flash.events.Event, but then I get several various errors. Currently my faulty code to load child objects and use contentLoaderInfo looks like: package { // Import stuff import flash.events.addEventListener; import flash.events.Event import flash.events.MouseEvent; import flash.display.*; import flash.net.URLRequest; import flash.display.Graphics; public class rte2124buserName { var rect1:Shape = new Shape(); rect1.graphics.beginFill(0xFF); rect1.graphics.drawRect(0, 0, 1966, 660); addChild(rect1); var ldr1:Loader = new Loader(); ldr1.mask = rect; var url1:String = topics/rte2124b_topic1.swf; var urlReq1:URLRequest = new URLRequest(url1); ldr1.load(urlReq1); ldr1.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler1); var rect2:Shape = new Shape(); rect2.graphics.beginFill(0xFF); rect2.graphics.drawRect(0, 0, 1966, 660); addChild(rect2); var ldr2:Loader = new Loader(); ldr2.mask = rect2; var url2:String = topics/rte2124b_topic2.swf; var urlReq2:URLRequest = new URLRequest(url2); ldr2.load(urlReq2); ldr2.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler2); // Call up topics from topics folder. public function completeHandler1(event:Event) { MovieClip(event.currentTarget)._parent = this; trace(_parent.ldr1); } public function completeHandler2(event:Event) { MovieClip(event.currentTarget)._parent = this; trace(_parent.ldr2); } } } All I want to do is to pass user input (user name) from a parent SWF to a child SWF. Could somebody please tell me all the code I need and where the code goes to do this. I am sorry that I can't work this out, and to be honest, Flash help is less than useless unless you have been doing OO programming for years. It does not contain decent examples of everything one needs to do to get stuff to work. Cheers Alan Hi Alan. In the same class / at the same position where you load your child movieclip. One line below your loadClip method call. This message is for the named persons use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or; lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient. GOULBURN OVENS INSTITUTE OF TAFE and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of any such entity. # This e-mail message has been scanned for Viruses and Content and cleared by MailMarshal # ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Re: Re: Passing text between SWFs
Alan Neilsen schrieb: Thanks dr.ache I still can't get this to work. Whatever is wrong, it doesn't like the line public function completeHandler(event:Event) {. ok, lets go trough this: package { // Import stuff import flash.events.addEventListener; what should that be? you can only import Classes, not Methods...so this line should look like this: import flash.events.EventDispatcher; because that is the class you can use to addEventListeners import flash.events.Event this should have an ; at the end of the line import flash.events.MouseEvent; import flash.display.*; import flash.net.URLRequest; import flash.display.Graphics; public class rte2124buserName { you should name your class with a capital letter at the beginning var rect1:Shape = new Shape(); rect1.graphics.beginFill(0xFF); rect1.graphics.drawRect(0, 0, 1966, 660); here you should enter: rect1.endFill(); otherwise flash would not draw anything addChild(rect1); var ldr1:Loader = new Loader(); ldr1.mask = rect; what you you doing here? if you want to mask ldr1 with rect1 then a) you must addChild(rect1); to the display list and b) you should name it rect1 not rect var url1:String = topics/rte2124b_topic1.swf; var urlReq1:URLRequest = new URLRequest(url1); ldr1.load(urlReq1); ldr1.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler1); i cut out the second shape here after that... you must close the constructor function..that is your main fault. here it comes: } now your completeHandler1 is outside of the constructor function and a method of your class. // Call up topics from topics folder. public function completeHandler1(event:Event) { this line should look like this: public function completeHandler1(event:Event):void { MovieClip(event.currentTarget)._parent = this; trace(_parent.ldr1); } } } All I want to do is to pass user input (user name) from a parent SWF to a child SWF. Could somebody please tell me all the code I need and where the code goes to do this. I am sorry that I can't work this out, and to be honest, Flash help is less than useless unless you have been doing OO programming for years. It does not contain decent examples of everything one needs to do to get stuff to work. Flash help helps you alot if you read it ... you need to read more depending on your level of knowledge. and for sure it does not give you all the code for every situation you could come in. but it definitely shows you how to set up your first class properly: Manual - Programming AS3 - Object Oriented programming - Classes and how to use the loader class: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html If you cant deal with it... pay someone for doing your job. The examples written at the loader class page assume that you put the code on the first frame of a fla file.. not in a seperate class file...that is why the compiler complaints ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders