Create a child cast member
Hi,
I need to create a dynamic menu for an application. Right
now I am creating every item as a new cast member:
newMember = new(#text)
member(newMember).name = "Item1"
member(newMember).text = "Blabla"
What I would like to do, is have an existing cast member with
the good font, font size, color, etc... and in my lingo script,
create all my new cast members based on the existing one, so I
would only need to change the text it contains and not the color,
size....
It could also be usefull to do this since I could attach a
behavior to the existing cast member and then all my new ones would
have the same behavior attached to them.
I hope this can be done, sorry if it is obvious, I'm in the
process of learning Director and Lingo.
Thanks,
Pat
Hi Pat, and welcome to the list.
As for your question, I'd suggest you work with a single cast
in general,
unless it really helps organizing your project.
Creating members on the fly -as it seems you are doing- is a
much cleaner
approach.
Why don't you create a handler that would accept as arguments
the formatting
options and the member they should be applied to?
Or e.g. two handlers that each would apply some fixed
formatting to a member
that is passed to it.
The less the members, the smaller the project, btw.
> It could also be useful to do this since I could attach
a behavior to the
> existing cast member
I suppose you are talking about cast member scripts, not
behaviors. Another
thing you'd better avoid, since behaviors (scripts attached
to sprites) are
more flexible, receive notifications that script members
don't (like e.g. on
beginSprite), and are designed for oop (a reference to the
script
object -me- is passed as the first argument by the system
when calling
behaviors' handlers).
"PDiLalla" <[email protected]> wrote in
message
news:f97p50$rh1$[email protected]..
> Hi,
>
> I need to create a dynamic menu for an application.
Right now I am
> creating
> every item as a new cast member:
>
> newMember = new(#text)
> member(newMember).name = "Item1"
> member(newMember).text = "Blabla"
>
> What I would like to do, is have an existing cast member
with the good
> font,
> font size, color, etc... and in my lingo script, create
all my new cast
> members
> based on the existing one, so I would only need to
change the text it
> contains
> and not the color, size....
>
> It could also be usefull to do this since I could attach
a behavior to the
> existing cast member and then all my new ones would have
the same behavior
> attached to them.
>
> I hope this can be done, sorry if it is obvious, I'm in
the process of
> learning Director and Lingo.
>
> Thanks,
> Pat
>
Similar Messages
-
How can I save a cast member to the hard drive?
Hi,
I am using 'canvas' from the Paintbox library.
I found a line of code on the forum to create a 'new' cast member.
Now, I'd like to save that new cast member to the hard drive.
BuddyApi doesn't have an option to do that, and I haven't had any luck with the Xtras lists I've found.
How can I accomplish this?
Thanks in advance for your assistance,
BigDaddyTo elaborate, this is how you would call the Xtra in your code:
-- create the instance of the xtra
objImg = xtra("ImgXtra").new()
-- get the member's image we want to save
imgToSave = member("foobar").image
-- set the path and filename for the bitmap
strFileName = the moviePath & "foobar.jpg"
-- call the ix_saveImage method, with required parameters
success = objImg.ix_saveImage(["image": imgToSave, "filename": strFileName])
-- returns 1 if successful, 0 if not
if success then
-- something here
else
-- something else here
end
-- clear the xtra object instance
objImg = VOID
The other optional parameters such as format and flags can be set, if you like, and the info can be found in the imgXtra.txt document. -
Creating a new instance of a cast member
I want to create an instance of a cast member on stage, that
will not exist as a new member in the cast.
I read some stuff about child objects, but I wasn't
successful in getting it to work.
I also want to be able to create more than one instance, and
to be able to manipulate them separately.
Can someone help?
Thanks a lot,
IsaacThere is a variety of ways to accomplish this ("is" agreeing
with "a
variety" not "of ways"). You can puppet as many sprite
channels as you need
and assign the one cast member to each. Each will function
independently
although any modification to the cast member itself will be
reflected in
each sprite instance.
The following code takes the first cast member in the first
castLib and
places it on the stage 10 times using channels 1-10. It
places the sprites
side by side horizontally. The position is not important but
I showed that
each sprite can be treated independently, in this case by
setting the loc
property. Of course you can do this with any sprite property.
The
significant lines are 2 and 3.
repeat with x = 1 to 10
sprite (x).puppet = TRUE
sprite (x).member = member (1)
xPos = member (1).width * (x - 1) + (member (1).width / 2)
sprite (x).loc = point (xPos, member (1).height / 2)
end repeat
Craig
"ytlevine" <[email protected]> wrote in
message
news:ggk8be$fr7$[email protected]..
>I want to create an instance of a cast member on stage,
that will not exist
>as
> a new member in the cast.
> I read some stuff about child objects, but I wasn't
successful in getting
> it
> to work.
> I also want to be able to create more than one instance,
and to be able to
> manipulate them separately.
> Can someone help?
> Thanks a lot,
> Isaac
> -
I am working on MDI application which was developed in VC++ in VS 2012. When my application is launched, it will display a Tree. Under a tree there are 254 nodes. Basically
these nodes data are read from Configuration xml file and loaded into the Tree. By double clicking on each node, first it will create object for document class ( By calling CreateNewDocument() method) after that member variables for that
document class will be initialized and then it will create the new frame window (by calling
CreateNewFrame(pDoc,NULL). New child frame window will show under Main window to the user.
User able to see the data from child frame window.
Similarly by double clicking on each node it will create another object for the same document class and new child frame window will be opened for that node. Each child frame window runs
in different data and showed under the Main window.
Existing requirement by double clicking on each node, node data shall show in separate child window and there is no requirement for all 254 child windows opened simultaneously.
But current requirement is , all 254 child windows shall open simultaneously by double clicking on each node one by one.
In debug mode I have tried double clicking on each node. I able to open up to 50 nodes. After 50th child windows are opened, I unable to access to the application
(Unable to open further node data window since application is getting hanged).
Each child window is having tree, multiple splitter window and some additional controls (static text, ...).
Same I have tried in release mode, I able to open up to 136 child windows. After that the application fail to create the new frame window in VS 2012. i.e CreateNewFrame() return
NULL after successful created 136 child frame window. Debug purpose I have added the code to retrieve last error code by calling GetLastError() method. I got the value as "0". By closing any existing child window then I able to open remaining nodes.
At any point of time I can reach maximum of 136 child frame window that can be opened under Main window. Failing to open all 254 child frame window
simultaneously, currently I fail to meet the current requirement.
current Requirement is all 254 child frame window are opened simultaneously. Please let me know what may be the reason fail to create new frame window after 136 frame window that are
opened already. In Microsoft site, mentioned that there is no limitation for creating frame window in MDI application. I have tried another sample MDI application having limited number of controls, in which I able to create "n"
number of child frame windows. why not able to create more than 136 child frame window in my actual application?
Is there any possibility by changing project settings allow me to create 254 child frame window??
Code Snippet as below:
CDiagBaseDoc * CDiagBaseMDocTemplate::OpenDiagView( ...)
CDiagBaseDoc* pDoc = NULL;
if (pDoc == NULL)
pDoc = (CDiagBaseDoc*)CreateNewDocument();
if ( pDoc )
CFrameWnd* pFrame = NULL;
if (bAlreadyOpen)
// If Child frame window already opened, then handling the code here.
else
pFrame = CreateNewFrame(pDoc, NULL);
if (pFrame == NULL)
ASSERT(FALSE);
delete pDoc; // explicit delete on error
pDoc = NULL;
ASSERT_VALID(pFrame);
if( pDoc != NULL ) //VS2012
if ( !pDoc->OnNewDocument() )
TRACE0("CDocument::OnNewDocument returned FALSE\n");
delete pDoc; // explicit delete on error
pDoc = NULL;
pFrame->DestroyWindow();
pFrame = NULL;
if (pFrame)
InitialUpdateFrame(pFrame, pDoc);
ShowWindow( pFrame->GetSafeHwnd(), SW_MAXIMIZE ); //when opening node for the 1st time, maximize it
}<o:p></o:p>Hi MuruganK,
Have you checked how much memory your application used? You could check it by Task Manager. Maybe your application reach Memory Limits for Windows.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa366778%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
Is it possible that there are some memory leaks in your application? It would better if you have made a simple sample to reproduce and narrow down this issue.
Best regards,
Shu
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Excel or table style grid in text cast member
I copied an Excel style table out of MS Word and pasted it
into a text cast member and to my surprise, the grid lines came
with the text, nicely formatted and everything. Having a
spreadsheet like grid (or something like an HTML table) that would
auto fit the contents of each cell sure would help.
Anyone know how to apply grid lines to text cast members I
create from scratch? and are there any formatting options I can
access from lingo to modify the grid?Check out the data grid in Inplicity, a fantastic set of
add-ins for Director. All Lingo based. They kick butt.
http://www.inplicitytoolkit.com/
best,
FBC -
Change cast member of another sprite on rollover?
There is probably a really easy answer for this question but I just have NO IDEA how to approach it and am about ready to blow my brains out ... (new at this, yes) so ANY HELP would be greatly appreciated.
When rolling over or "on mouseEnter me" of a certain sprite, I would like to change the cast member of ANOTHER sprite as well as the current one (having no problems with the current one as it's all set up in the behaviours lol) is this possible? and how would the lingo go for this?
thanksDon't do what Multiduck suggests. Sprites should never change the properties of other sprites. That is a bad practice prone to creating nasty bugs.
Create a behavior for the second sprite that has a handler for changing its member. You might call it "showRollOver". Then your first sprite simply calls that handler.
sprite(x).showRollOver()
If you want the second sprite to react to mouse overs, then just use the mouseEnter method and call that handler from the first sprite.
sprite(x).mouseEnter()
Note: You can directly call any handler that is added to a sprite, ie,
sprite(x).mouseDown()
sprite(x).beginSprite()
sprite(x).setText()
sprite(x).fadeOut() -
Load flash cast member in the root of flash sprite (is possible?)
load flash cast member in the root of flash sprite, is
possible?i explain better, the user must download the projector from
internet and i
want protect the swf files include these in one exe
application
this is what my client want
tnanks
"Rob Dillon - Adobe Community Expert"
<[email protected]> ha
scritto nel messaggio
news:[email protected]..
> I'm not sure when or where you would need this
functionality. If you are
> creating a projector, then how are you distributing it?
If you are using
> a CD, then it doesn't matter how many files you have.
>
> If you want to bundle everything together for a
download, then just use
> an installer.
>
> --
> Rob
> _______
> Rob Dillon
> Adobe Community Expert
>
http://www.ddg-designs.com
> 412-243-9119
>
>
http://www.macromedia.com/software/trial/ -
Can anyone tell me why the %^$& I get a "script cast
member not found"
error?
I've been working in Director for 17 years and I get this
from time to time.
I generally just copy the code from the behavior, paste it
into a new
behavior, name the new one the same as the old on, then copy
the new cast
member over the old one and it solves it. But it happened
rarely enough
that I didn't bother questioning why. I know it's not a
syntax error
because the code runs fine after the above process. But it
does only
happens when I've made a change to the code in that behavior.
Now I'm working with a simple movie with one parent script
and a
prepareMovie handler that instantiates one child object and
I'm getting this
darn error all the time. My above solution isn't working
anymore. The
error points to the first line of a particular handler. That
first line was
a comment. So I got rid of the comment and the new first line
of the
handler is code and the error points to it. If you see where
I'm headding,
no matter how many lines of "errored" code I get rid of the
error alert will
always point to the first line of that handler.
I'm sure many have seen this because it's happened in almost
every version
of Director I've owned. And by the way, I'm in MX on a PC.
Craig Wollman
Lingo Specialist
Word of Mouth Productions
212-928-9581
www.wordofmouthpros.comDean, I might do that. No, this has been going on long enough
that I sure
it's not any definable user error.
But, I did, after all of these years, discover something last
night. In one
case, I did get a legitimate script error that I fixed. When
I ran the
project again, I received the same script error, even though
it was a simple
fix and I was sure I corrected it. I recompiled several times
and ran it
again and received the error again. Then it dawned on me that
since parent
scripts remain in memory until disposed of, Director must
have been, for
some reason, referring to the old parent script. I had
already set the
object's global variable to 0 in my stopMovie handler and
even though that
handler might not always run when errors occur, I ran it from
the message
window to insure that the object's global was 0. But that
still didn't
solve the problem. Then I used clearGlobals in the message
window and
voila, the issue went away. Dare I say that this is a
shortcoming of
Lingo's design to allow variables to persist/linger after an
error?
But what still baffles me is that most of the time when I get
that
particular error,, even though I seemed to have found a
workaround, it is
not an actual issue with any code.
When it happens again, I'll send you the code. Obviously, if
I'm correct
about the scripts lingering in memory, then you won't receive
the error when
you run the movie.
I just find it interesting that there haven't been a bunch of
"Yeah, I get
that darn thing too" here.
Craig
Craig Wollman
Lingo Specialist
Word of Mouth Productions
212-928-9581
www.wordofmouthpros.com
"Dean Utian" <[email protected]> wrote in message
news:[email protected]...
> Hi Craig,
>
> Could it be a simple mistake of the script type not
being properly defined
> (movie/parent/behavior)?
>
> If you have a very baic movie where this error occurs
repeatedly, you
> could
> email me ([email protected]) and I'll take a fresh
perspective look at
> it.
>
> regards
> Dean
>
> Director Lecturer / Consultant
>
http://www.fbe.unsw.edu.au/learning/director
>
http://www.multimediacreative.com.au
>
>
>
> -
Class override, how to create the child class and then the base class
I started to write a program for a smart DMM, the problem is every version of the DMM the company change the communication commend.
My idea is to write a child class for every DMM version and every SubVI of the child will override the base class SubVI.
My problem is, i want first to create one child class and after i will see every thing is work, start to create the base class. that way i will see if am thinking the right way.
My question is
How can i create a child class and then create the base class and configure the SubVi of the child class to be Override of the base class?
I tried to search in the property of the class but i didn't see nothing.
Thanks
Solved!
Go to Solution.This can be done and I've done it on occasion.
You simply create the base class with the dynamic dispatch methods you require (connector panes need to be identical to thos of the child class).
Then set the inheritance of the class to inherit from this base class. If your method is defined as a dynamic dispatch method in the parent, you'll most likely now have some errors (unless your child method was already DD in which case you might just be OK already).
To change the inheritance of a class, right-click the properties of the class in your project and select properties. I believe the ineritance tree is at the lower end of the properties. Click on the "change inheritance" (or something similar) to choose the class from which you now wish to inherit.
Say hello to my little friend.
RFC 2323 FHE-Compliant -
Problem creating parent child relatioship in derby database
hi.i m trying to develop a code that can access two tables using derby database.The data in the tables should go from the JTable of GUI which i have prepared.To read both table's properties i m using two different instances of java.util.Properties.using InputStream i m reading the properties and then i try to create the tables.The parent table is created but the child table is never created.Also i m able to insert as well as fetch the data from parent table but the child table,as not created throws Derby's error messages.
I need help in this matter.
Could anybody give suggestions?The problem in creating a child table is that i m using two different .property files for two tables,one for parent and one for child table.I perform all the steps similar to those i performed to create parent table.But i dont know,somehow it creates only parent table and all the time when i run the code the error message for the child table comes that the table does not exist.
-
How to create Parent Child relationship of Assets
Hi All
can any one provide the solution for the below mention requirment.
Problem Description: How to create Parent Child relationship of Assets in below case.
1. If asset Category of Child assets are different but both parent & child assets are already capitalized.
2. If asset Category of Child assets are same but both parent & child assets are already capitalized.
3. If asset Category of Child assets are same for new assets.Hi All
can any one provide the solution for the below mention requirment.
Problem Description: How to create Parent Child relationship of Assets in below case.
1. If asset Category of Child assets are different but both parent & child assets are already capitalized.
2. If asset Category of Child assets are same but both parent & child assets are already capitalized.
3. If asset Category of Child assets are same for new assets. -
How to intersect with any sprite of a certain cast member?
Hi. I am trying to script a simple 2d platformer engine for a larger University project. I have movement sorted with W and A and gravity. I can get collision detection with the floor by doing
if sprite 1 intersects sprite 2 then
gvGrav = 0
end if
Sprite 1 is the player and sprite 2 is an instance of the cast member called ground. How would I get this to work with any sprite that is ground? Ill paste the full code below.
global gvRight
global gvLeft
global gvGrav
global gvDown
on enterFrame
-----------MOVE LEFT---------------------
if keyPressed("a") then
sprite(4).locH=sprite(4).locH+gvLeft
_movie.updateStage()
gvLeft = gvLeft - .5
if gvLeft < - 15 then
gvLeft = -15
end if
end if
if not keypressed("a") then
gvLeft = 0
end if
-----------MOVE RIGHT--------------------
if keyPressed("d") then
sprite(4).locH=sprite(4).locH+gvRight
_movie.updateStage()
gvRight = gvRight + .5
if gvRight > 15 then
gvRight = 15
end if
end if
if not keypressed("d") then
gvRight = 0
end if
-----------GRAVITY-------------------------
gvGrav = gvGrav
sprite(4).locV=sprite(4).locV+gvGrav
_movie.updateStage()
gvGrav = gvGrav +.5
if gvGrav > 30 then
gvGrav = 30
end if
-------------GravityCollision----------------------
if sprite 4 intersects sprite 1 then
gvGrav = 0
end if
if sprite 4 intersects sprite 2 then
gvGrav = 0
end if
end ifI dare say there's a better way to do this, but an easy way is to set a global variable, do a sendallsprites message, and check the global variable again.
So, if you had an extra global in your man control script:
global hitman
then in your collision checking part you would say this:
hitman = false
sendallsprites #checkcollision 4
if hitman = true then
gvGrav = 0
end if
The #checkcollision message would get sent to all sprites, and if you had a behavior placed on the floor sprites, that was like this:
global hitman
property mysprite
on beginsprite me
mysprite = the spritenum of me
end
on checkcollision me,s
if sprite s intersects sprite mysprite then
hitman = true
end if
end
any one of those sprites that intersected with the sprite you ask about would then change the global 'hit man' variable to be true. To make a sprite behave like floor, you would just attach that behavior script.
Notice how the floor sprite makes a note of its sprite number when it first shows up on the stage, you could do the same with your other script, if it's attached to the man character. Then you wouldn't have to have it hard coded to '4', which would save some headaches later if you have to change the sprite layers. -
Hi,
QUERY:
I've 'MAIN' code base as parent branch.
From 'MAIN' parent branch, I need to create multiple child 'Development' branches (Dev1, Dev2,etc..) for consecutive releases.
I don't want Child branch creating with entire code from Parent branch. i.e Each DEVELOPMENT branch should not be a full branch of MAIN.
Is it possible to create child branches with specific code from Parent.
For example:
MAIN -> Parent branch contain Project1, Project2,...........Project10.
DEV1 -> Child branch which contains Project2 and Project3 alone.
DEV2 -> Child branch which contains Project2, Project5, Project6, Project7, Project8 alone.
NOTE:
I'm trying to create a 'Basic branching Plan' to maintain the Source Code in TFS, for consecutive release with concurrent development.
i.e
MAIN <--- FI & RI -----> Dev1, Dev2, Dev3
MAIN <------- RI alone ---| Release1, Release2, Release3
I'm new to TFS, please advice for the above mentioned branching specific query.
Also, if possible, please suggest me the best branching strategy according to my need.
Regards,
Riswan BabuHi Riswan,
It's unavailable to branch a folder or team project partly, it always copying the same source code from its parent when you create a branch in your team project. For you requirement, you might try the methods below to see if it works for you:
1. Since the DEV1 and DEV2 have different, you can have two folders(like MAIN) in your team project and each folder include the projects/solutions you need. No need to create two branches that include different projects
2. Create two branches from Main, and delete the additional projects that you want to keep. Then develop with the branches separately.
3. Or create the branches from Main but keep all the content, just modify the projects you need in each branch. The difference will merge back in root branch if you need to merge back finally.
For release, you can create sub-branches from the two branches you created as you requirement. And you can check the links below for more information about branching and merging:
http://msdn.microsoft.com/en-us/magazine/gg598921.aspx
http://vsarbranchingguide.codeplex.com/
Best regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How create Nested Child Nodes in XML Forms
Hello All:
I am very new to XML Forms/KM. I am trying to figure out a way to create Nested Child Nodes schema in XML Forms. Is there a way we can do it?
Thanks and Regards,
Vasu.Document document;
NodeList[] dataNodeList=new NodeList[2];
NodeList nodeList=document.getElementsByTagName("MyData");
for(int i=0; i<nodeList.getLength(); i++)
dataNodeList=nodeList.getChildNodes();
Maybe you are looking for
-
Can't access management interface via vpn connection
Hi all, I can't seem to be able to manage my ASA 5510 when I connect via vpn. My asa sits at a remote colo, and from my office i can connect fine. I have it configured as management-access (dmz), bc as of now we are just doing some staging and all th
-
Please allow to number in boxes in Keynote
Dear Apple. If you read this, please can you allow that when I select text in multiple rows in a table in keynote, and try to number them, instead of them all becoming "1.", the actually number "1., 2., 3." etc? Thank you Others, please like this so
-
Need to find day of week then set variable
Hello all! I'm trying to make sure a variable that is a date, needs to be sun to be set as one way, else any other day another way. Here is my code BEGIN SELECT CASE WHEN @IssueDate2(WEEKDAY, GETDATE()) = 1 THEN (set @IssueDate3_mjssun= CONVERT(VARC
-
Help! How do i make a button state maintain when there are other buttons on the page?
I need to have the down state of pressed buttons stay in that state when there are multiple buttons being pressed on the same html page...
-
How can I import a powerpoint file into imovie?
I am trying to import a powerpoint presentation into imovie keeping the transition times. Can you help?