Re: [Flashcoders] Interaction between clips and main timeline in AS3.
As mentionned before, the orthodox way is to follow OOP philosophy, but it's actually not immediate to get training about it, and also follow the logical consequences of this choice, such as adopting proper tools for actionscript editing (eg:FlashDevelop) and versioning (eg:SVN), etc.. Even under the auspices of a qualified teacher, it can take days. But it's a good investment. A simple (class-free) solution to your practical problem may be to write on frame 1 of you clip_mc: Object(parent).countN++; (But you won't get an error message if countN variable doesn't exist, therefore this practice can make debugging quite difficult) Hope it helps, Olivier Henrik Andersson a écrit : natalia Vikhtinskaya wrote: THANK YOU Just remember that you just turned off all type safety and even the slightest typo will result in a runtime error instead of a compile time error. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Olivier Besson (gludion) - (33 1) 44 64 78 99 http://www.gludion.com http://blog.gludion.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interaction between clips and main timeline in AS3.
Thank you your help. But I still can not get it works. Can anybody give simple example how clip from a library with timeline animation can get and set variables in root in any frame of this animation? Thank you 2010/4/16 Henrik Andersson he...@henke37.cjb.net: natalia Vikhtinskaya wrote: In linkage properties class is clip_mc That is a typical instance name, not a class name. Also, I am talking about the class name for the document class. ___ 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] Interaction between clips and main timeline in AS3.
Can you set an include on the first frame of the added movie clip that adds the appropriate class to record the variables and then talk to the main timeline? You could maybe set the include statement in an onEnterFrame or its AS3 equiv.? Then the include statement would only get added when that frame entered the playhead? I am AS2 as well and am learning AS3 currently. Would like to know how this works as well. Thanks, Karl On Apr 16, 2010, at 2:08 AM, natalia Vikhtinskaya wrote: Thank you your help. But I still can not get it works. Can anybody give simple example how clip from a library with timeline animation can get and set variables in root in any frame of this animation? Thank you 2010/4/16 Henrik Andersson he...@henke37.cjb.net: natalia Vikhtinskaya wrote: In linkage properties class is clip_mc That is a typical instance name, not a class name. Also, I am talking about the class name for the document class. ___ 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 Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interaction between clips and main timeline in AS3.
Karl DeSaulniers wrote: Can you set an include on the first frame of the added movie clip that adds the appropriate class to record the variables and then talk to the main timeline? You don't include classes, you import them. It was the same deal in as 2. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interaction between clips and main timeline in AS3.
Oops, I meant import. :P Been working in PHP a lot lately. :) Karl On Apr 16, 2010, at 3:23 AM, Henrik Andersson wrote: Karl DeSaulniers wrote: Can you set an include on the first frame of the added movie clip that adds the appropriate class to record the variables and then talk to the main timeline? You don't include classes, you import them. It was the same deal in as 2. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interaction between clips and main timeline in AS3.
Hey Natalia, I found this which may solve your immediate problem. I have never used this before, but it looks promising. http://www.jumpeyecomponents.com/Flash-Components/Various/ ActionScript-Bridge-91/ Might be worth a look-see. HTH, Karl On Apr 16, 2010, at 2:08 AM, natalia Vikhtinskaya wrote: Thank you your help. But I still can not get it works. Can anybody give simple example how clip from a library with timeline animation can get and set variables in root in any frame of this animation? Thank you 2010/4/16 Henrik Andersson he...@henke37.cjb.net: natalia Vikhtinskaya wrote: In linkage properties class is clip_mc That is a typical instance name, not a class name. Also, I am talking about the class name for the document class. ___ 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 Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interaction between clips and main timeline in AS3.
I have two good books Loey Lott and Colin Moock but could not find answer for this simple situation. Maybe this is not simple for AS3? 2010/4/16 Karl DeSaulniers k...@designdrumm.com: Oops, I meant import. :P Been working in PHP a lot lately. :) Karl On Apr 16, 2010, at 3:23 AM, Henrik Andersson wrote: Karl DeSaulniers wrote: Can you set an include on the first frame of the added movie clip that adds the appropriate class to record the variables and then talk to the main timeline? You don't include classes, you import them. It was the same deal in as 2. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Karl DeSaulniers Design Drumm http://designdrumm.com ___ 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] Interaction between clips and main timeline in AS3.
I think its not simple because you are scripting timeline wise. Got to pick. AS2 or AS3. I believe what they were trying to say was if you have all the code in classes, you can communicate between the root and the added movie clip because the classes reference each other, not the timeline. Plus you will be referencing objects, so communicating between the objects through the classes is how it's done in AS3. Am I on the right track guys? Karl On Apr 16, 2010, at 3:52 AM, natalia Vikhtinskaya wrote: I have two good books Loey Lott and Colin Moock but could not find answer for this simple situation. Maybe this is not simple for AS3? 2010/4/16 Karl DeSaulniers k...@designdrumm.com: Oops, I meant import. :P Been working in PHP a lot lately. :) Karl On Apr 16, 2010, at 3:23 AM, Henrik Andersson wrote: Karl DeSaulniers wrote: Can you set an include on the first frame of the added movie clip that adds the appropriate class to record the variables and then talk to the main timeline? You don't include classes, you import them. It was the same deal in as 2. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Karl DeSaulniers Design Drumm http://designdrumm.com ___ 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 Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interaction between clips and main timeline in AS3.
natalia Vikhtinskaya wrote: I have two good books Loey Lott and Colin Moock but could not find answer for this simple situation. Maybe this is not simple for AS3? Step by step: 1. Assign a class to the timeline. 2. Get a reference to the timeline using the parent or root properties. 3. Cast the reference from the basetype to the class that you used in step 1. 4. PROFIT! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interaction between clips and main timeline in AS3.
Karl DeSaulniers wrote: I think its not simple because you are scripting timeline wise. Got to pick. AS2 or AS3. I believe what they were trying to say was if you have all the code in classes, you can communicate between the root and the added movie clip because the classes reference each other, not the timeline. Plus you will be referencing objects, so communicating between the objects through the classes is how it's done in AS3. Am I on the right track guys? You are not. You have gotten tangled up in the elitism spread by people who doesn't actually work with Flash. There is no reason not to use the properties that you have to get the references. You just need to remember to cast them to the proper type. The trick is to know when to apply the fancy rules and when not to. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interaction between clips and main timeline in AS3.
So, my untested proposal is this: Root timeline, don't instantiate your subclip with code. Just put it on the stage with an instance name, and refer to it then. In the subclip, you can then refer to parent.counter or whatever your variable is, because you're guaranteed that you have a parent if you never instantiate the subclip with code. I think the problem was, you instantiated clip_mc before adding it to the stage (of course), but then it's constructor you are asking for something in its parent - but it doesn't have a parent yet. Eventually learn classes and work it out that way, but we shouldn't stonewall you from using timeline code for a simple animator's task (this is one reason why Flash is so pervasive guys, because it was easy for you to jump into with basic interactivity, right?). -jonathan , On Fri, Apr 16, 2010 at 2:24 AM, Henrik Andersson he...@henke37.cjb.netwrote: Karl DeSaulniers wrote: I think its not simple because you are scripting timeline wise. Got to pick. AS2 or AS3. I believe what they were trying to say was if you have all the code in classes, you can communicate between the root and the added movie clip because the classes reference each other, not the timeline. Plus you will be referencing objects, so communicating between the objects through the classes is how it's done in AS3. Am I on the right track guys? You are not. You have gotten tangled up in the elitism spread by people who doesn't actually work with Flash. There is no reason not to use the properties that you have to get the references. You just need to remember to cast them to the proper type. The trick is to know when to apply the fancy rules and when not to. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interaction between clips and main timeline in AS3.
Yes I expected that Flash and AS3 could be used for simple task without creating classes. But as I see now it is not true. If you I have clip with some animation and I want communicate with main timeline at the end of animation I cannot do that. And I cannot find any solution for that. I have the same error if clip with animation is on stage or it is added with code on main timeline. trace(parent.countN) from the clip and result is 1119: Access of possibly undefined property countN through a reference with static type flash.display:DisplayObjectContainer. What can be more simple than this task? And that does not work. 2010/4/16 jonathan howe jonathangh...@gmail.com: So, my untested proposal is this: Root timeline, don't instantiate your subclip with code. Just put it on the stage with an instance name, and refer to it then. In the subclip, you can then refer to parent.counter or whatever your variable is, because you're guaranteed that you have a parent if you never instantiate the subclip with code. I think the problem was, you instantiated clip_mc before adding it to the stage (of course), but then it's constructor you are asking for something in its parent - but it doesn't have a parent yet. Eventually learn classes and work it out that way, but we shouldn't stonewall you from using timeline code for a simple animator's task (this is one reason why Flash is so pervasive guys, because it was easy for you to jump into with basic interactivity, right?). -jonathan , On Fri, Apr 16, 2010 at 2:24 AM, Henrik Andersson he...@henke37.cjb.netwrote: Karl DeSaulniers wrote: I think its not simple because you are scripting timeline wise. Got to pick. AS2 or AS3. I believe what they were trying to say was if you have all the code in classes, you can communicate between the root and the added movie clip because the classes reference each other, not the timeline. Plus you will be referencing objects, so communicating between the objects through the classes is how it's done in AS3. Am I on the right track guys? You are not. You have gotten tangled up in the elitism spread by people who doesn't actually work with Flash. There is no reason not to use the properties that you have to get the references. You just need to remember to cast them to the proper type. The trick is to know when to apply the fancy rules and when not to. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ 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] Interaction between clips and main timeline in AS3.
File Publish Settings Flash Actionscript 3.0 Settings Strict Mode (uncheck it) that's your easiest solution if you are having trouble. once you get more into the AS3 side of things you won't need it any more... On 16 April 2010 17:33, natalia Vikhtinskaya natavi.m...@gmail.com wrote: Yes I expected that Flash and AS3 could be used for simple task without creating classes. But as I see now it is not true. If you I have clip with some animation and I want communicate with main timeline at the end of animation I cannot do that. And I cannot find any solution for that. I have the same error if clip with animation is on stage or it is added with code on main timeline. trace(parent.countN) from the clip and result is 1119: Access of possibly undefined property countN through a reference with static type flash.display:DisplayObjectContainer. What can be more simple than this task? And that does not work. 2010/4/16 jonathan howe jonathangh...@gmail.com: So, my untested proposal is this: Root timeline, don't instantiate your subclip with code. Just put it on the stage with an instance name, and refer to it then. In the subclip, you can then refer to parent.counter or whatever your variable is, because you're guaranteed that you have a parent if you never instantiate the subclip with code. I think the problem was, you instantiated clip_mc before adding it to the stage (of course), but then it's constructor you are asking for something in its parent - but it doesn't have a parent yet. Eventually learn classes and work it out that way, but we shouldn't stonewall you from using timeline code for a simple animator's task (this is one reason why Flash is so pervasive guys, because it was easy for you to jump into with basic interactivity, right?). -jonathan , On Fri, Apr 16, 2010 at 2:24 AM, Henrik Andersson he...@henke37.cjb.net wrote: Karl DeSaulniers wrote: I think its not simple because you are scripting timeline wise. Got to pick. AS2 or AS3. I believe what they were trying to say was if you have all the code in classes, you can communicate between the root and the added movie clip because the classes reference each other, not the timeline. Plus you will be referencing objects, so communicating between the objects through the classes is how it's done in AS3. Am I on the right track guys? You are not. You have gotten tangled up in the elitism spread by people who doesn't actually work with Flash. There is no reason not to use the properties that you have to get the references. You just need to remember to cast them to the proper type. The trick is to know when to apply the fancy rules and when not to. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ 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 mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interaction between clips and main timeline in AS3.
THANK YOU 2010/4/16 tom rhodes tom.rho...@gmail.com: File Publish Settings Flash Actionscript 3.0 Settings Strict Mode (uncheck it) that's your easiest solution if you are having trouble. once you get more into the AS3 side of things you won't need it any more... On 16 April 2010 17:33, natalia Vikhtinskaya natavi.m...@gmail.com wrote: Yes I expected that Flash and AS3 could be used for simple task without creating classes. But as I see now it is not true. If you I have clip with some animation and I want communicate with main timeline at the end of animation I cannot do that. And I cannot find any solution for that. I have the same error if clip with animation is on stage or it is added with code on main timeline. trace(parent.countN) from the clip and result is 1119: Access of possibly undefined property countN through a reference with static type flash.display:DisplayObjectContainer. What can be more simple than this task? And that does not work. 2010/4/16 jonathan howe jonathangh...@gmail.com: So, my untested proposal is this: Root timeline, don't instantiate your subclip with code. Just put it on the stage with an instance name, and refer to it then. In the subclip, you can then refer to parent.counter or whatever your variable is, because you're guaranteed that you have a parent if you never instantiate the subclip with code. I think the problem was, you instantiated clip_mc before adding it to the stage (of course), but then it's constructor you are asking for something in its parent - but it doesn't have a parent yet. Eventually learn classes and work it out that way, but we shouldn't stonewall you from using timeline code for a simple animator's task (this is one reason why Flash is so pervasive guys, because it was easy for you to jump into with basic interactivity, right?). -jonathan , On Fri, Apr 16, 2010 at 2:24 AM, Henrik Andersson he...@henke37.cjb.net wrote: Karl DeSaulniers wrote: I think its not simple because you are scripting timeline wise. Got to pick. AS2 or AS3. I believe what they were trying to say was if you have all the code in classes, you can communicate between the root and the added movie clip because the classes reference each other, not the timeline. Plus you will be referencing objects, so communicating between the objects through the classes is how it's done in AS3. Am I on the right track guys? You are not. You have gotten tangled up in the elitism spread by people who doesn't actually work with Flash. There is no reason not to use the properties that you have to get the references. You just need to remember to cast them to the proper type. The trick is to know when to apply the fancy rules and when not to. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ 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 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] Interaction between clips and main timeline in AS3.
natalia Vikhtinskaya wrote: THANK YOU Just remember that you just turned off all type safety and even the slightest typo will result in a runtime error instead of a compile time error. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interaction between clips and main timeline in AS3.
Darn, I thought I was close. :( That last statement you said is what I have the hardest time figuring out about AS3. When to use classes and how to use them and the fancy rules that goes with EVERYTHING about AS3. I think I may just wait till AS4. lol. Karl On Apr 16, 2010, at 4:24 AM, Henrik Andersson wrote: Karl DeSaulniers wrote: I think its not simple because you are scripting timeline wise. Got to pick. AS2 or AS3. I believe what they were trying to say was if you have all the code in classes, you can communicate between the root and the added movie clip because the classes reference each other, not the timeline. Plus you will be referencing objects, so communicating between the objects through the classes is how it's done in AS3. Am I on the right track guys? You are not. You have gotten tangled up in the elitism spread by people who doesn't actually work with Flash. There is no reason not to use the properties that you have to get the references. You just need to remember to cast them to the proper type. The trick is to know when to apply the fancy rules and when not to. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Interaction between clips and main timeline in AS3.
Hi, Seems you may have solved this by turning off strict mode. An alternative way (depending on how flexible you can be with your program) would be to reverse your approach and listen to what frame the clip is on (myClip.currentFrame) and perform functions accordingly. As long as you know what frame you want to trigger a function, you can do all the programming on the timeline in one place. I have put an example on pastebin for you to try. MyClip is a 12 frame animated movieclip in the library. Here is the link: http://pastebin.org/153959 Hope it helps, David Date: Fri, 16 Apr 2010 11:08:28 +0400 Subject: Re: [Flashcoders] Interaction between clips and main timeline in AS3. From: natavi.m...@gmail.com To: flashcoders@chattyfig.figleaf.com Thank you your help. But I still can not get it works. Can anybody give simple example how clip from a library with timeline animation can get and set variables in root in any frame of this animation? Thank you 2010/4/16 Henrik Andersson he...@henke37.cjb.net: natalia Vikhtinskaya wrote: In linkage properties class is clip_mc That is a typical instance name, not a class name. Also, I am talking about the class name for the document class. ___ 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 _ http://clk.atdmt.com/UKM/go/19780/direct/01/ Do you have a story that started on Hotmail? Tell us now___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interaction between clips and main timeline in AS3.
David Hunter wrote: Hi, Seems you may have solved this by turning off strict mode. An alternative way (depending on how flexible you can be with your program) would be to reverse your approach and listen to what frame the clip is on (myClip.currentFrame) and perform functions accordingly. As long as you know what frame you want to trigger a function, you can do all the programming on the timeline in one place. I have put an example on pastebin for you to try. MyClip is a 12 frame animated movieclip in the library. Here is the link: http://pastebin.org/153959 Hope it helps, David It's probably a bad idea to poll the currentFrame property each frame. Flash already has framescripts. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Interaction between clips and main timeline in AS3.
Hi to all On main timeline I have var countN:int=0; // this numberl be changed later var clip_mc = new clip_mc(); // this clip is placed in library addChild(clip_mc); How can I read countN inside clip_mc? parent.countN, this.parent.countN gives a mistake. That was possible in AS2 but I can not find solution for AS3. Thanks in advance. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interaction between clips and main timeline in AS3.
natalia Vikhtinskaya wrote: On main timeline I have var countN:int=0; // this numberl be changed later var clip_mc = new clip_mc(); // this clip is placed in library addChild(clip_mc); How can I read countN inside clip_mc? I would pass in a reference to the timeline to the clip_mc. You will need to have a class with a constructor for the clip_mc. For example, set the linkage of clip_mc to ClipClass, and create this AS file: package { public class ClipClass extends MovieClip { private var myRoot:MovieClip; private var parentCount:Number; public function ClipClass (pMyRoot:MovieClip) { myRoot = pMyRoot; } private function getCount():Number { parentCount = myRoot.countN; } } } There are undoubtedly errors in this--it's just e-mail ActionScript, but it should be enough to get you going. I would recommend very strongly against timeline programming in ActionScript 3, though. It's designed for OOP, and you'll find your code much more manageable if you use OOP practices. Instead of putting code on the timeline, put it in a class, and make that your document class. Cordially, Kerry Thompson ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interaction between clips and main timeline in AS3.
In clip_mc I have timeline animation. When it finished I should change countN++ on main timeline. I tested as you suggested. I created ClipClass.as (just addedimport flash.display.MovieClip;) on main timeline I have code var clip_mc:MovieClip=new ClipClass(); // linkage with name ClipClass in library addChild(clip_mc); Now that does not work 1017: The definition of base class MovieClip was not found. 5000: The class 'ClipClass' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type. I 2010/4/15 Kerry Thompson al...@cyberiantiger.biz: natalia Vikhtinskaya wrote: On main timeline I have var countN:int=0; // this numberl be changed later var clip_mc = new clip_mc(); // this clip is placed in library addChild(clip_mc); How can I read countN inside clip_mc? I would pass in a reference to the timeline to the clip_mc. You will need to have a class with a constructor for the clip_mc. For example, set the linkage of clip_mc to ClipClass, and create this AS file: package { public class ClipClass extends MovieClip { private var myRoot:MovieClip; private var parentCount:Number; public function ClipClass (pMyRoot:MovieClip) { myRoot = pMyRoot; } private function getCount():Number { parentCount = myRoot.countN; } } } There are undoubtedly errors in this--it's just e-mail ActionScript, but it should be enough to get you going. I would recommend very strongly against timeline programming in ActionScript 3, though. It's designed for OOP, and you'll find your code much more manageable if you use OOP practices. Instead of putting code on the timeline, put it in a class, and make that your document class. Cordially, Kerry Thompson ___ 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] Interaction between clips and main timeline in AS3.
natalia Vikhtinskaya wrote: In clip_mc I have timeline animation. When it finished I should change countN++ on main timeline. I tested as you suggested. I created ClipClass.as (just added import flash.display.MovieClip; ) on main timeline I have code var clip_mc:MovieClip=new ClipClass(); // linkage with name ClipClass in library addChild(clip_mc); Now that does not work 1017: The definition of base class MovieClip was not found. 5000: The class 'ClipClass' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type. There are a couple of issues. The first is the easiest: include this line in your ClipClass.as: import flash.display.MovieClip; Now, take all your code off the main timeline and put it into a file called Main.as. Add the package and class declarations (and a constructor if you want, though it's not required), and set Main as your document class. ActionScript 3 really doesn't want to be programmed like AS2. It's a new paradigm. You can get by with AS2-style timeline programming, but you're likely to end up with hard-to-maintain spaghetti code. I'd recommend you take a step back and acquaint yourself with Object Oriented principals. I call it sharpening your axe. Sure, it takes time to sharpen an axe, and you can chop wood with a dull axe. But, if you take time to sharpen it, at the end of the day you will have a much larger pile of chopped wood. Cordially, Kerry Thompson ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interaction between clips and main timeline in AS3.
Is that possible to do that without creating class? I need very simple task: movie in the library with timeline animation, I add this movie on the stage, play animation, change variable on the main timeline. Is that possible without creating two new classes? 2010/4/15 Kerry Thompson al...@cyberiantiger.biz: natalia Vikhtinskaya wrote: In clip_mc I have timeline animation. When it finished I should change countN++ on main timeline. I tested as you suggested. I created ClipClass.as (just added import flash.display.MovieClip; ) on main timeline I have code var clip_mc:MovieClip=new ClipClass(); // linkage with name ClipClass in library addChild(clip_mc); Now that does not work 1017: The definition of base class MovieClip was not found. 5000: The class 'ClipClass' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type. There are a couple of issues. The first is the easiest: include this line in your ClipClass.as: import flash.display.MovieClip; Now, take all your code off the main timeline and put it into a file called Main.as. Add the package and class declarations (and a constructor if you want, though it's not required), and set Main as your document class. ActionScript 3 really doesn't want to be programmed like AS2. It's a new paradigm. You can get by with AS2-style timeline programming, but you're likely to end up with hard-to-maintain spaghetti code. I'd recommend you take a step back and acquaint yourself with Object Oriented principals. I call it sharpening your axe. Sure, it takes time to sharpen an axe, and you can chop wood with a dull axe. But, if you take time to sharpen it, at the end of the day you will have a much larger pile of chopped wood. Cordially, Kerry Thompson ___ 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] Interaction between clips and main timeline in AS3.
natalia Vikhtinskaya wrote: Hi to all On main timeline I have var countN:int=0; // this numberl be changed later var clip_mc = new clip_mc(); // this clip is placed in library addChild(clip_mc); How can I read countN inside clip_mc? Wait for the clip to be ADDED. The use the parent or root property to get a reference to the main timeline. Do note that the type will be DisplayObjectContainer, not something with your custom stuff, so you will have to cast it to your correct type. Here, the MainTimeline. Variables defined in framescripts are converted to properties of the class for the timeline. In this case, properties of the document class. So do this: With the scope of clip_mc (say, the constructor or framescript in first frame): addEventListener(Event.ADDED,added); function added(e:Event) { var countN:int=MainTimeline(root).countN; } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interaction between clips and main timeline in AS3.
Maybe I do something wrong? On main timeline in the first frame var countN:int=0; var clip_mc = new clip_mc(); addChild(clip_mc); in the firtst frame of clip_mc addEventListener(Event.ADDED,added); function added(e:Event) { var countN:int=MainTimeline(root).countN; //trace(countN) } that gives error 1180: Call to a possibly undefined method MainTimeline. 2010/4/15 Henrik Andersson he...@henke37.cjb.net: natalia Vikhtinskaya wrote: Hi to all On main timeline I have var countN:int=0; // this numberl be changed later var clip_mc = new clip_mc(); // this clip is placed in library addChild(clip_mc); How can I read countN inside clip_mc? Wait for the clip to be ADDED. The use the parent or root property to get a reference to the main timeline. Do note that the type will be DisplayObjectContainer, not something with your custom stuff, so you will have to cast it to your correct type. Here, the MainTimeline. Variables defined in framescripts are converted to properties of the class for the timeline. In this case, properties of the document class. So do this: With the scope of clip_mc (say, the constructor or framescript in first frame): addEventListener(Event.ADDED,added); function added(e:Event) { var countN:int=MainTimeline(root).countN; } ___ 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] Interaction between clips and main timeline in AS3.
natalia Vikhtinskaya wrote: Maybe I do something wrong? On main timeline in the first frame var countN:int=0; var clip_mc = new clip_mc(); addChild(clip_mc); in the firtst frame of clip_mc addEventListener(Event.ADDED,added); function added(e:Event) { var countN:int=MainTimeline(root).countN; //trace(countN) } that gives error 1180: Call to a possibly undefined method MainTimeline. You need to have the class that you are casting to. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interaction between clips and main timeline in AS3.
In linkage properties class is clip_mc 2010/4/16 Henrik Andersson he...@henke37.cjb.net: natalia Vikhtinskaya wrote: Maybe I do something wrong? On main timeline in the first frame var countN:int=0; var clip_mc = new clip_mc(); addChild(clip_mc); in the firtst frame of clip_mc addEventListener(Event.ADDED,added); function added(e:Event) { var countN:int=MainTimeline(root).countN; //trace(countN) } that gives error 1180: Call to a possibly undefined method MainTimeline. You need to have the class that you are casting to. ___ 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] Interaction between clips and main timeline in AS3.
natalia Vikhtinskaya wrote: In linkage properties class is clip_mc That is a typical instance name, not a class name. Also, I am talking about the class name for the document class. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders