Enable image on mouse click

Hi! I was trying to make a script, but i am new to it and i don’t know exactly how to enable and disable a UI image, so i made this script:

#pragma strict

//Below is my image variable.

var Img : UI.Image;



function Update () {

    if (Input.GetKeyDown ("Fire2"))
        Img.SetActive (true);

    //But i get the error "SetActive is not a member of "UnityEngine.UI.Image".
    //What is wrong? =P


}

I don’t know what is wrong… The strange this about this is that i searched a lot and i only found questions with no answer or questions using C#, but i have choosen to use Javascript because it is more compatible

I have c# version.

    using UnityEngine.UI;
    public Image Bg1;
    void Awake()
    	{
            Bg1.enabled = false;//Untested code
          }

Hope this may help you.
Nsks

Your problem is that UI.Image is not a gameobject but an script, you could use .setActive if you use it like:

var img : GameObject;

function SetImageActive(){
      img.SetActive(true);
}

ps. please start your variable names with lowercase…