[Flashcoders] private - public
Hi list I've already posted this problem, and you have answered me, but the problem is back, and I did what you told me. I've got my core class : Core.as containing this import myProjetPath.proxy.CommandManager; class Core { private var oCM:CommandManager [...] function Core() { this.oCM = new CommandManager(this); } } so You've seen that CommandManager is linked by the private var oCM in my fla, in the root timeline, I've written: import myProjectPath.Core; var oCore:Core = new Core(); and I tried to call a public method AddEvent in the CommandManager like this: _root.oCore.oCM.AddEvent(oParams); and it worked, even if oCM is private !!! It should not accept this line! why does it work please? You've told me that my oCore prop wasn't typed because it was formerly _root.oCore = new Core(), but now I've typed it... PR ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] private/public troubles
did you type your instance of oCore on root ? if your data is not typed the iDE will not enforce access modifiers. e.g var core:Core = new Core() trace (core.oParam); /// should not compile var anotherCore = new Core() trace (anotherCore .oParam); /// should compile as anotherCore is not typed. because you are declaring it on root is probably not typed. Why put it on root ? Grant. - Original Message - From: PR Durand [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: 12/14/05 9:54 AM Subject: [Flashcoders] private/public troubles Hi List! This is not really a problem, but rather a question cause it seems strange... I've got a Core.as class containing private var oParam:ParamMngr; and this.oParam = new ParamMngr(); in the ParamMngr class, we can see private var mcGround:MovieClip; and theuse of it. into flash, on main stage, I've put the following: import com.domain.Core; _root.oCore = new Core(); and then tried trace(_root.oCore.oParam.mcGround); -- it worked !!! why? each variable is private... so how can it run? thx, PR ___ 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] private/public troubles
Thanx a lot Grant, I think you pointed right. 'will test it. Why on _root? because the project is a full external code, and this class is the core of the application, so why not putting it on _level0 (so mainSwf._root) ? Is it better to make a CoreComponent and drag it to the scene? PR [EMAIL PROTECTED] a écrit : did you type your instance of oCore on root ? if your data is not typed the iDE will not enforce access modifiers. e.g var core:Core = new Core() trace (core.oParam); /// should not compile var anotherCore = new Core() trace (anotherCore .oParam); /// should compile as anotherCore is not typed. because you are declaring it on root is probably not typed. Why put it on root ? Grant. - Original Message - From: PR Durand [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: 12/14/05 9:54 AM Subject: [Flashcoders] private/public troubles Hi List! This is not really a problem, but rather a question cause it seems strange... I've got a Core.as class containing private var oParam:ParamMngr; and this.oParam = new ParamMngr(); in the ParamMngr class, we can see private var mcGround:MovieClip; and theuse of it. into flash, on main stage, I've put the following: import com.domain.Core; _root.oCore = new Core(); and then tried trace(_root.oCore.oParam.mcGround); -- it worked !!! why? each variable is private... so how can it run? thx, PR ___ 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] private/public troubles
If I have a main Application class I generally drag it to the stage and then in my external code I have the application start in the onload method of the class. I never use root, in your case its probably not a big deal I just find sometime in the future a use of root would come back and bite me. using _root is generally considered a no-no. stone the blasphemer!, stone the blasphemer ! :) Grant - Original Message - From: PR Durand [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: 12/14/05 11:21 AM Subject: Re: [Flashcoders] private/public troubles Thanx a lot Grant, I think you pointed right. 'will test it. Why on _root? because the project is a full external code, and this class is the core of the application, so why not putting it on _level0 (so mainSwf._root) ? Is it better to make a CoreComponent and drag it to the scene? PR [EMAIL PROTECTED] a écrit : did you type your instance of oCore on root ? if your data is not typed the iDE will not enforce access modifiers. e.g var core:Core = new Core() trace (core.oParam); /// should not compile var anotherCore = new Core() trace (anotherCore .oParam); /// should compile as anotherCore is not typed. because you are declaring it on root is probably not typed. Why put it on root ? Grant. - Original Message - From: PR Durand [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: 12/14/05 9:54 AM Subject: [Flashcoders] private/public troubles Hi List! This is not really a problem, but rather a question cause it seems strange... I've got a Core.as class containing private var oParam:ParamMngr; and this.oParam = new ParamMngr(); in the ParamMngr class, we can see private var mcGround:MovieClip; and theuse of it. into flash, on main stage, I've put the following: import com.domain.Core; _root.oCore = new Core(); and then tried trace(_root.oCore.oParam.mcGround); -- it worked !!! why? each variable is private... so how can it run? thx, PR ___ 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