Well SharedObject is an Abstract class so ends this idea...
#2012: AdvancedSharedObject class cannot be instantiated.
Time to rethink this approach :)
*
package* com.component
{
*import* flash.errors.IllegalOperationError;
*import* flash.net.SharedObject;
*import* mx.controls.Alert;
*import* mx.core.mx_internal;
*use* *namespace* mx_internal;
*public* *class* AdvancedSharedObject *extends* SharedObject
{
*private* *var* _instance:AdvancedSharedObject;
*public* *function* AdvancedSharedObject()
{
*
// if (!_instance) {
*
*super*();
*
// }
// else
// throw new IllegalOperationError('Only one AdvancedSharedObject can exist!
Use AdvancedSharedObject.getInstance()');
*
}
*public* *function* getInstance():SharedObject{
*return* _instance;
}
*
/*
public function getLocalAdvance(name:String,localPath:String =
null,secure:Boolean = false):SharedObject{
try{
return _instance
}catch(e:Error){
Alert.show(e.message.toString(),"Error Attempt to retreive getLocal(" +
name.toString() + ")")
}
return null
}
mx_internal final function $getLocal(name:String,localPath:String =
null,secure:Boolean = false):SharedObject{
return _instance.getLocal(name,localPath,secure)
}
*/*
}
}
On Fri, Sep 25, 2009 at 8:50 PM, David <[email protected]> wrote:
> Ok, I see the problem:
> function getLocal is a static function.
> That is, if you make a variable like so
> var s:SharedObject;
> you can't do this:
> s.getLocal("");
> but you can do this:
> SharedObject.getLocal();
>
> Trying to do this:
> override static function getLocal(name:String,localPath:String=null,
> secure:Boolean=false):ShareObject{
> I get this error:
> Functions cannot be both static and override.
> But I've never overridden anything before, so I might just have the syntax
> wrong.
>
> -David
>
>
> On Fri, Sep 25, 2009 at 8:34 PM, Eric DeCoff <[email protected]> wrote:
> > Yeah,
> >
> > Tried that.. get error
> >
> > 1020: Method marked override must override another method.
> >
> >
> > package
> >
> > com.component
> >
> > {
> >
> > import flash.net.SharedObject;
> >
> > import flash.net.SharedObject.*;
> >
> > import mx.controls.Alert;
> >
> > // use namespace mx_internal;
> >
> > public class AdvancedSharedObject extends SharedObject
> >
> > {
> >
> > public function AdvancedSharedObject()
> >
> > {
> >
> > super();
> >
> > }
> >
> > override function getLocal(name:String,localPath:String,secure:Boolean =
> > false):SharedObject{
> >
> > return super.getLocal(name);
> >
> > }
> >
> > }
> >
> > }
> >
> > On Fri, Sep 25, 2009 at 4:57 PM, David <[email protected]> wrote:
> >>
> >> I'm not familiar with this syntax:
> >> override getLocal function getLocalAdvanced(...
> >>
> >> I would think it would just be
> >> override function getLocal(...
> >>
> >> -David
> >>
> >> On Fri, Sep 25, 2009 at 11:22 AM, Eric DeCoff <[email protected]>
> >> wrote:
> >> > Hey all,
> >> >
> >> > What am I doing wrong?
> >> >
> >> >
> >> > <pre lang="mxml">
> >> >
> >> > package
> >> >
> >> > com.component
> >> >
> >> > {
> >> >
> >> > import flash.net.SharedObject;
> >> >
> >> > import mx.controls.Alert;
> >> >
> >> > public dynamic class AdvancedSharedObject extends SharedObject
> >> >
> >> > {
> >> >
> >> > public function AdvancedSharedObject()
> >> >
> >> > {
> >> >
> >> > super();
> >> >
> >> > }
> >> >
> >> > override getLocal function
> >> > getLocalAdvanced(name:String,localPath:String,secure:Boolean =
> >> > false):SharedObject{
> >> >
> >> > try {
> >> >
> >> > return super.getLocal(name);
> >> >
> >> > }
> >> >
> >> > catch (e:Error) {
> >> >
> >> > Alert.show(e.message.toString(),
> >> >
> >> > "Error Opening Shared Object")
> >> >
> >> > return null
> >> >
> >> > }
> >> >
> >> > }
> >> >
> >> > }
> >> >
> >> > }
> >> >
> >> > </pre>
> >>
> >>
> >> -------------------------------------------------------------
> >> To unsubscribe from this list, simply email the list with unsubscribe in
> >> the subject line
> >>
> >> For more info, see http://www.affug.com
> >> Archive @ http://www.mail-archive.com/discussion%40affug.com/
> >> List hosted by http://www.fusionlink.com
> >> -------------------------------------------------------------
> >>
> >>
> >
> >
>
>