x


iTween-Error :: "Cannot cast from source type to destination type"

Hi there!

I got this error

Cannot cast from source type to destination type.

when I use this script to move the camera

function OnMouseEnter()
{
    //Camera.main.GetComponent(CameraMover).MoveToPosition();
    camPosX = cam.transform.position.x;
    camPosY = cam.transform.position.y;
    if(!isActive) iTween.moveTo(cam,{"y":(camPosY+100), "x":(camPosX + 100) , "time":2, "transition":"easeOutExpo"});
    toggleActive();
}

function OnMouseExit()
{
    if(isActive) {
    iTween.stop(cam);
    iTween.moveTo(cam,{"y":camPosY, "x":camPosX, "time":1, "transition":"easeOutExpo", "onComplete": toggleActive});
    }
}
function toggleActive()
{
    isActive = !isActive;
    Debug.Log("isActive: " + isActive);
}

Why is that?

Thnx!

more ▼

asked May 11 '10 at 03:21 PM

headkit gravatar image

headkit
280 25 28 36

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Actually you'll need cam to be a GameObject and the callback needs to be sent as a string: "onComplete": "toggleActive"

Hope that helps!

more ▼

answered May 14 '10 at 07:02 AM

pixelplacement gravatar image

pixelplacement
682 8

(comments are locked)
10|3000 characters needed characters left

It probably needs to be cam.transform for all of those cam references - i haven't used the library but my guess is it takes transforms to move objects

more ▼

answered May 11 '10 at 04:02 PM

Mike 3 gravatar image

Mike 3
30.5k 10 65 253

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1950
x426
x69
x18

asked: May 11 '10 at 03:21 PM

Seen: 1776 times

Last Updated: May 11 '10 at 03:21 PM