Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Transparent Image overlay

I am making an Scratchpad widget for iBooks Author.


I have got a worksheet where students need to draw the arms of the clock in the right angles.

I have got a transparent PNG with the arms of the clock in the correct positions and a button "check answers"


How can I make it so that when I click the button the image appears?


I have tried the action lists. But no matter what I try the image appears in the first frame before I click the "check answer" button.

MacBook Air, OS X Yosemite (10.10.3), null

Posted on May 2, 2015 3:01 PM

Reply
2 replies

Jun 3, 2015 11:16 PM in response to suzannelust

Open up the code editor and, in Global.js, create an array with the correct time images you have e.g.


window.globalVar = "timepics";

timepics = [
    assets/timepic1.png,
    assets/timepic2.png
];


However many images you have put a comma at the end of each line except the last in your array list. Put your timepic1.png, timepic2.png, etc images in the assets panel in your iAd project.


Create and import an image the same size as your timepic images. This image, when tapped will be replaced with the correct answer. Because it needs to be tapped, it can't be transparent, but it could be styled as a button with "Check!" or something written in the middle. Add this code to the image in the code editor, deleting whatever code might appear there when you first open up the code editor:


this.onViewTouchDown = function (event) {
  this.viewController.startActionWithSourceView({
  "className" : "iAP.ImageSourceAction",
  "delay" : 0,
  "properties" : {
    "duration" : 0.0001,
    "targetViewId" : "Page1-MyImageName", 
      "url" : timepics[0], // This is timepic1.png (remember that the first item in an array is at index 0, not 1!)
      "height" : 165, //change this to whatever your image height is
      "width" : 173 //change this to whatever your image width is
  }
}, this);
};


The MyImageName value of your tappable image is the Properties > Name value in the iAd Inspector. Replace MyImageName in the code with whatever appears there.

Transparent Image overlay

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.