Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 2:14 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: ILMObject - How to manipulate
PostPosted: May 21st, 2010, 2:49 pm 
Offline

Joined: May 25th, 2008, 4:57 pm
Posts: 355
Location: Ireland
Opus: Pro 9.75
OS: Windows 10
System: MacBook Pro (Intel 2020)
Hi,

I am cloning object, and want to be able to destroy them, without destroying all. So I am using the this.GetParent() to get the name of the object, Opus returns something like this:
[ILMObject TypeText.2147483648]

How can I use this name, this code won't work for me:

Code:
ClonedName = this.GetParent()
var destroyThisClone = ClonedName + ".DestroyClonedObject()"
Debug.trace("Eval " + destroyThisClone + "\n")
eval(destroyThisClone)


I have also tried:

Code:
ClonedName + ".DestroyClonedObject()


Am I missing something here, or doing something silly on a Friday evening? Thanks everyone, LMC.

_________________
Opus Pro 9.75 on MacBookPro (2020 Intel) running Parallels 19 with Windows 10 (x64)


For this message lmc has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: ILMObject - How to manipulate
PostPosted: May 21st, 2010, 3:13 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Second person today missing this.

Why not just destroy this?

Code:
this.DestroyClonedObject()


Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: ILMObject - How to manipulate
PostPosted: May 21st, 2010, 3:52 pm 
Offline

Joined: May 25th, 2008, 4:57 pm
Posts: 355
Location: Ireland
Opus: Pro 9.75
OS: Windows 10
System: MacBook Pro (Intel 2020)
Hi,

Yeah I normally would use that. But I am using a button within a frame to destroy, so "this" method wouldn't work as it would refer to the button, not the cloned frame.

See attached screenshot of the cloned frame of objects, text_input, button within a frame.

Thanks though.


You do not have the required permissions to view the files attached to this post.

_________________
Opus Pro 9.75 on MacBookPro (2020 Intel) running Parallels 19 with Windows 10 (x64)


For this message lmc has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: ILMObject - How to manipulate
PostPosted: May 21st, 2010, 4:45 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
this.GetParent().DestroyClonedObject()

...but don't break the international laws of cloning...

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


For this message mackavi has been thanked by : lmc


Top
 Profile Visit website  
 
 Post subject: Re: ILMObject - How to manipulate
PostPosted: May 21st, 2010, 8:12 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Quote:
want to be able to destroy them, without destroying all.
how about...

them.DestroyClonedObject() :P

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: ILMObject - How to manipulate
PostPosted: May 24th, 2010, 10:16 am 
Offline

Joined: May 25th, 2008, 4:57 pm
Posts: 355
Location: Ireland
Opus: Pro 9.75
OS: Windows 10
System: MacBook Pro (Intel 2020)
Hi,

Thanks for the reply. I tried
Code:
this.GetParent().DestroyClonedObject()


But when I do it the app closes completely. See attached zipped imp file.

Just to note too that I want to have multiple cloned objects, so can't just call the cloned var name as that will destroy all so will be setting up so array to store them in, just doing some testing now.


You do not have the required permissions to view the files attached to this post.

_________________
Opus Pro 9.75 on MacBookPro (2020 Intel) running Parallels 19 with Windows 10 (x64)


For this message lmc has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: ILMObject - How to manipulate
PostPosted: May 24th, 2010, 6:03 pm 
Offline

Joined: May 25th, 2008, 4:57 pm
Posts: 355
Location: Ireland
Opus: Pro 9.75
OS: Windows 10
System: MacBook Pro (Intel 2020)
I have been working on destroy clone function can anyone help with the following, would be real help thanks.

I get errors for the following, object named TypeText that I have cloned. I don't use this. as explained earlier.

When cloned the clone object has the following name: [ILMObject TypeText.2147483648]

To destroy I try the following, but I get an error:
[ILMObject TypeText.2147483648].DestroyClonedObject()

So I snipped the string down just the following, but get error too (double . is causing issue?)
TypeText.2147483648.DestroyClonedObject()


I use the eval() function to do this, and the error is:
Code passed to the eval() function contained errors


Any suggestions that will make this work?

Thanks, LMC.

_________________
Opus Pro 9.75 on MacBookPro (2020 Intel) running Parallels 19 with Windows 10 (x64)


For this message lmc has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: ILMObject - How to manipulate
PostPosted: May 24th, 2010, 6:08 pm 
Offline

Joined: May 25th, 2008, 4:57 pm
Posts: 355
Location: Ireland
Opus: Pro 9.75
OS: Windows 10
System: MacBook Pro (Intel 2020)
This is the code I used when trying to destroy the clone:

Code:
//DestroyNewClone(this.GetParent());
//this.GetParent().DestroyClonedObject()

Debug.trace("THIS NAME " + this.GetParent() + "\n")

var frank = this.GetParent();
var louise = frank.toString();

//GETS THE LENGTH JUST TO CHECK STRING
var louiseLength = String.length(louise);
Debug.trace("louiseLength\t" + louiseLength + "\n")

//RETURNS THE NAME PLUS CLONE CODE
var subCloneString = louise.substring(11,30)
Debug.trace("subString\t" + subCloneString + "\n")

//DESTROY THE CLONE
var destroyThisClone = subCloneString + ".DestroyClonedObject()"
Debug.trace("Eval\t\t" + destroyThisClone + "\n")
eval(destroyThisClone)

/*
var destroyThisClone = "\"" + louise + "\".DestroyClonedObject()"
Debug.trace("Eval " + destroyThisClone + "\n")
eval(destroyThisClone)
*/


Sorry about the random var names in advance.

_________________
Opus Pro 9.75 on MacBookPro (2020 Intel) running Parallels 19 with Windows 10 (x64)


For this message lmc has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: ILMObject - How to manipulate
PostPosted: May 24th, 2010, 8:58 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Sounds like this post may be useful (partly describing and solving the same problem?).
viewtopic.php?f=4&t=2102&hilit=clone+name

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : lmc, mackavi


Top
 Profile  
 
 Post subject: Re: ILMObject - How to manipulate
PostPosted: May 25th, 2010, 5:19 pm 
Offline

Joined: November 11th, 2004, 1:43 pm
Posts: 172
Location: Buckinghamshire, UK
lmc,
I am putting together a tutorial on this, since I am looking into this already.
You can reach me on eomc40@yahoo.co.uk in the meantime.


For this message eomc40 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: ILMObject - How to manipulate
PostPosted: May 28th, 2010, 2:28 pm 
Offline

Joined: May 25th, 2008, 4:57 pm
Posts: 355
Location: Ireland
Opus: Pro 9.75
OS: Windows 10
System: MacBook Pro (Intel 2020)
I cannot get the destroy clone to work with the code, so instead I'm hiding it. Not ideal but a good work around for the time being.

Is there a reason why this code works:
Code:
this.GetParent().Hide();


But this code does not work, instead it actually crashes the publication:
Code:
this.GetParent().DestroyClonedObject();




Thanks,

_________________
Opus Pro 9.75 on MacBookPro (2020 Intel) running Parallels 19 with Windows 10 (x64)


For this message lmc has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: ILMObject - How to manipulate
PostPosted: May 28th, 2010, 5:11 pm 
Offline

Joined: November 11th, 2004, 1:43 pm
Posts: 172
Location: Buckinghamshire, UK
Please see this small vid on some tests I am running. The code is bloody messy and will need time to cleanup before I can send out the file since what I have here is a cummulative effect of adding functionality to an item as I went along and better methods can achieve some of the tasks hence don't want it to confuse and complicate things for any potential user of clone operations.


Attachment:
clone.gif


So to get started, here is code that will make this task easier

In this case I have an object named line that will form the basis of the clones. In the video sampler, the actual call to clone is instigated by the line (blue) draw, upon completion of which a clone is created (yellow line) and replaces this line.

I have a global variable "num" that starts at zero and is increamented after each clone has been created
Code:
//line 1
eval("clone" + num + "= line.CloneObject()");

//line2
eval(cloneList[num] = "clone" + num);

//line3
num++;


What the above line 1 gives us is a clone object that will if we interrogated its name i.e on a mouseover action

Code:
Debug.trace("\nOBJECT NAME: " + this.GetName());


will give us the dreaded line.1782147483 but we have also created a logical name for the clone

"clone" + num which will hence be clone0 for the first item. but this is not held anywhere at this point hence line 2 of the code part of the required script

Code:
eval(cloneList[num] = "clone" + num +" "+ findNewCloneObject() );


What this does is store the clones in an array global variable called cloneList. I am using the num as the index marker since I will only increament it after this operation line 3

Again, this is just for this particular implementation but assume could be required by your code, the function as named will get our line.1782147483 type name inorder to store it in the array

in this example, our array stored would be like

clone0 line.1782147483
clone1 line.1782147484
clone2 line.1782147485
clone3 line.1782147486


Now we have a repository that can be used to store all entries of clone objects and crucially, when we need to delete it, we need to use the logical name that we have stored. In this case, we have to trawl through the array and grab the line

Delete operation
On right mouse click I need to first get my logical name from the array, here is a function used.

the code in right mouse click action follows below it is the called script inArray

Code:
if(this.GetName() != "line") {
  //Get the line in array for this object and return first word to variable toDestroy
  var toDestroy = String.word(inArray(this.GetName()),1);
  wait (0);
  eval(toDestroy + ".DestroyClonedObject()");
}


Code:
function inArray(str) {
  for (i=0;i<clones.length;i++) {
    if (String.contains(clones[i], str, true)) {
      break
    }
  }
  return clones[i]
}








other code as referenced above follows

findNewCloneObject()

Code:
function findNewCloneObject() {
  var toReturn = ""
  xbefore = xchildrenBefore.split(",");
  xafter = xchildrenAfter.split(",");

  for (i=0;i<xafter.length;i++) {
    notfound = true;

    for (n=0;n<xbefore.length;n++) {
      if (String.contains(xbefore[n], xafter[i], true)) {
        notfound = false
      }
    }
    if (notfound == true) {
      //NOT FOUND
      toReturn = xafter[i];
    } else {
      //FOUND
    }
  }
  return toReturn
}




This forms the bulk of what you need and hope you will find it useful, and as I mentioned earlier it is specific to what I needed to implement and you can guide me on what your actions are and I can tailor above to that requirement.

eomc40.


You do not have the required permissions to view the files attached to this post.


For this message eomc40 has been thanked by : lmc, mackavi


Top
 Profile  
 
 Post subject: Re: ILMObject - How to manipulate
PostPosted: May 28th, 2010, 9:16 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
This is a good case for Ockham's Razor.

The line below will work...

Code:
this.GetParent().DestroyClonedObject()


...but you have to remember what's happening.

For example, imagine driving a car at 60mph when the car suddenly vanishes. The result would be an unfortunate accident for the driver. The solution, ensure the car is stationary before making the car vanish.

Apply the same principle to your clone. Ensure any actions (yours or Opus') performed on the clone have completed before destroying it.

Code:
wait(x)
this.GetParent().DestroyClonedObject()


The value of x can be almost instantaneous to any upper limit depending on what actions are running - for example some kind of transition effect.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: ILMObject - How to manipulate
PostPosted: May 29th, 2010, 7:43 pm 
Offline

Joined: May 25th, 2008, 4:57 pm
Posts: 355
Location: Ireland
Opus: Pro 9.75
OS: Windows 10
System: MacBook Pro (Intel 2020)
Hi Mack,

Thanks for your reply. Can you have a look at the attached imp file, and notice the issue with destroying the clone.

Currently I'm using the .Hide() function to get the desired result. But would prefer to use the DestroyClonedObject()

I must be doing something very wrong here. Help would be great, thanks.


You do not have the required permissions to view the files attached to this post.

_________________
Opus Pro 9.75 on MacBookPro (2020 Intel) running Parallels 19 with Windows 10 (x64)


For this message lmc has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: ILMObject - How to manipulate
PostPosted: May 29th, 2010, 10:22 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Fixed.

Mack


You do not have the required permissions to view the files attached to this post.

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


For this message mackavi has been thanked by : lmc


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 43 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group