Motorcykey
9 years agoVisitor
Accessing a global object inside a SceneGraph Component
Hello,
I'm fairly new to SceneGraph. I have a library of methods, basically utility functions which I've created that I'd like to use in my SceneGraph components. Things like modifying arrays, make calls to retrieve XML from an HTTP service, and parse the XML.
After reading the documentation, it sounded like I should be using 'screen.getGlobalNode()' to assign my object of functions into a global scope that would become accessible to the SceneGraph component. However, when I take a look at the object, I'm attempting to access, all of the functions are defined as 'invalid' and attempting to access them will crash the app:
<Component: roAssociativeArray> =
{
addfavorite: invalid
analytics_parameters: "channel=23&sessionKey={0}&upc={1}&chapterId={2}&percentPlayed={3}&stopped="
bcc: <Component: roAssociativeArray>
calljsonservice_: invalid
callxmlservice_: invalid
checkkey: invalid
checklogin: invalid
checksubscription: invalid
context: <Component: roAssociativeArray>
getbookmarks: invalid
getfavorites: invalid
getkey: invalid
getloginkey: invalid
getloginkeybyuser: invalid
getsessionkey: invalid
login_key: "my_login_key"
loginmode: ""
logout: invalid
registeruser: invalid
session_key: "my_session_key"
trackevent: invalid
validateemail: invalid
validatepassword: invalid
validatereceipt: invalid
validatetransaction: invalid
}
Any variables set on the object are accessible as I would expect, but the functions themselves are not. (Basically, anything listed as "invalid" up there.)
Is there a way to store a library of globally accessible utility functions in one place that can be accessed by any SceneGraph Components?
Thank you,
-Mikey
I'm fairly new to SceneGraph. I have a library of methods, basically utility functions which I've created that I'd like to use in my SceneGraph components. Things like modifying arrays, make calls to retrieve XML from an HTTP service, and parse the XML.
After reading the documentation, it sounded like I should be using 'screen.getGlobalNode()' to assign my object of functions into a global scope that would become accessible to the SceneGraph component. However, when I take a look at the object, I'm attempting to access, all of the functions are defined as 'invalid' and attempting to access them will crash the app:
<Component: roAssociativeArray> =
{
addfavorite: invalid
analytics_parameters: "channel=23&sessionKey={0}&upc={1}&chapterId={2}&percentPlayed={3}&stopped="
bcc: <Component: roAssociativeArray>
calljsonservice_: invalid
callxmlservice_: invalid
checkkey: invalid
checklogin: invalid
checksubscription: invalid
context: <Component: roAssociativeArray>
getbookmarks: invalid
getfavorites: invalid
getkey: invalid
getloginkey: invalid
getloginkeybyuser: invalid
getsessionkey: invalid
login_key: "my_login_key"
loginmode: ""
logout: invalid
registeruser: invalid
session_key: "my_session_key"
trackevent: invalid
validateemail: invalid
validatepassword: invalid
validatereceipt: invalid
validatetransaction: invalid
}
Any variables set on the object are accessible as I would expect, but the functions themselves are not. (Basically, anything listed as "invalid" up there.)
Is there a way to store a library of globally accessible utility functions in one place that can be accessed by any SceneGraph Components?
Thank you,
-Mikey