Re: Parent Property And Facespan
Re: Parent Property And Facespan
- Subject: Re: Parent Property And Facespan
- From: "Arthur J Knapp" <email@hidden>
- Date: Tue, 09 Jan 2001 16:17:22 -0500
>
Date: Tue, 09 Jan 2001 15:42:20 +0100
>
Subject: Parent Property And Facespan
>
From: cris <email@hidden>
>
I try to use a parent property in a FS project script. Parent properties
>
normally work well when i use them but FS and FS-applications have obvious a
>
problem to initialise the parent property on runtime. In the FS editor, the
>
parent property works only after the project has compiled once.
>
I get only errors when i try to change the parent at runtime, like:
>
>
on run
>
set parent to (load script "Mac HD:AS:MSA.Lib")
>
end
I don't think that this can be done at runtime. I'm also not sure
that I understand why you wish to do this at runtime. Loading a
compiled script at compile-time does the trick for me:
property parent : (load script "Mac HD:AS:MSA.Lib")
on run
-- do stuff
end
>
The AS-Language Guide says:
>
>
> The syntax for defining a parent script object is
>
> ( property | prop ) parent : variable where variable is a variable that
>
> contains the parent script object.
>
So far so good... but doesn't work in FS.
>
>
> A script object must be initialized before it can be assigned as a parent of
>
> another script object.
This is for when you are creating the script object within your script,
as:
script MyScript
-- stuff
end script
A script loaded with the "load script" command does not need to be
*initialized*, it just needs to be loaded.
>
... This means that the definition of the parent script
>
> object (or a command that calls a function that creates the parent script
>
> object) must come before the definition of the child in the same script.
script BaseScript
-- stuff
end script
script ChildScript
property parent : BaseScript
end script
>
I'm not sure if i understand this. Is there no way to set the parent on
>
runtime?
I still don't think I understand.
Here are some things that you can do at runtime:
script AParentObject
-- stuff
end script
-- OR --> property AParentObject : load script file "whatever"
on MakeScriptAtRuntime()
script
property parent : AParentObject
-- stuff
end
end
set Object1 to my MakeScriptAtRuntime()
set Object2 to my MakeScriptAtRuntime()
-- Object1 and Object2 are two child scripts that share the
-- same parent.
P.S. I don't have much experience with FaceSpan, sorry.
--
{
Arthur J Knapp, of STELLARViSIONs ;
http://www.STELLARViSIONs.com ;
mailto:email@hidden ;
"...well the rain falls down
without my help, I'm afraid
and my lawn gets wet,
though I withheld my consent..."
}