Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Sharing SharedObjects between Classes

Community Beginner ,
Feb 06, 2015 Feb 06, 2015

I have created a varable of Shared Object inside the Document Class

     EXAMPLE -> var so:SharedObject = SharedObject.getLocal("Barns","/");

but inside of a movieclip class I have

     if(so.data.adams == "yes"){

          adamsHighlight.visble = true}

and I get an error

E:\Android 2.0\ohioMap.as, Line 121120: Access of undefined property so.

what am i missing here. I thought if it was public, it is shared throughout the project

sorry new to classes.

TOPICS
ActionScript
211
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 07, 2015 Feb 07, 2015
LATEST

it is but so is not defined in your movieclip class unless you use:

var so:SharedObject=SharedObject.getLocal("Barns","/");

now, the so in your document class and in your movieclip class reference the same object.  eg,

//doc class

so.data.testvar="hi";

//movieclip class

trace(so.data.testvar);  // should trace 'hi'

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines