IAd Producer Switch Object

Hello All,
I'm attempting an iBook for my school, and I would like to add a widget to this book. In this widget I have an anatomical drawing, and I would like to use the switch object to toggle arrows on specific structures. I've been successful in getting the arrow to appear by setting the activated state of the switch to call an action whereby the arrow displays, however, there is no option for me to set the inactivated event, to "un-display" the arrow, on the object.
I need a bit of javascript to determine the state of the switch, so I can call the appropriate action list, but I have absolutely no idea how this is accomplished. I have zero experience with javascript.
any help is most appreciated.
best regards.

Hello,
Your best option would be to listen to the iAd.Switch onControlValueChange method and check the value of the on attribute to determine whether to show the arrows or not.  Pseudocode follows, but you will need to tweak to suit the rest of the widget.
Include in JavaScript for the switch control (click the "Code" button at bottom of iAd Producer with switch selected):
this.onControlValueChange = function (event) {
    if (this.on) {
        this.viewController.showArrows();
    else {
        this.viewController.hideArrows();
What the show/hideArrows methods do are up to you.  You could grab each of the arrows and change the visibility of the arrow.
Best of luck,
Josh

Similar Messages

  • IAd Producer and iBooks widget help

    Hello!
    I'm trying to use iAd Producer to create a drawing widget for an iBooks project. So far, I've been able to customize the standard drawing object and it works flawlessly on the iAd Producer Preview and in Safari, but not on the iOS Simulator nor the iPad.
    In the widget, there are 2 brush sizes available (small and large) and I'm trying to give visual feedback to the user, letting them know which one they selected. Initially I started with buttons but that didn't work because buttons don't have a style for on/off to let the user know that that button is selected.
    I switched to radio buttons, which works great on the preview but not the actual device. Here's the code I'm using:
    HTML:
    <label class="brushFrame">
    <input id="smallBrush" class="brush" type="radio" name="brush" value="small"><img src="assets/brush.png" />
    </label>
    <label class="brushFrame">
    <input id="largeBrush" class="brush" type="radio" name="brush" value="large"><img src="assets/brush.png" />
    </label>
    CSS:
    label.brushFrame > input.brush {
      display:none;
    label.brushFrame > input.brush + img {
      cursor: pointer;
      width: 50%;
      height: auto;
      position: relative;
      z-index: 1;
      transition: all 0.1s ease-in-out;
    label.brushFrame > input.brush:checked + img {
      opacity: 0.75 !important;
      z-index: 10 !important;
    Basically, the brush should become transparent when the user selects it and because it's a radio button, it will stay transparent until the user selects the other brush. The iOS Simulator and iPad are able to render all the CSS correctly, except for when the radio button is ":checked". Background: This is my first widget and I'm very comfortable with CSS but not JavaScript.
    How can I make this work?

    Many thanks for your reply patixa. Apologies for my incorrect typing of IDs, in my iAd code they do match.
    I have managed to resolve the problem as follows:
    All of my iAd content was originally on the Background layer. Placing the content on Page1 has resolved the problem.
    I'm not certain as to why the project worked in iAd producer preview/Safari/Widget preview but not in iBooks but no matter, switching to Page 1 solves it completely.
    I notice from a few of the problems people have posted that they have a similar situation and wonder if this might be something that would help them. I've not posted replies but wonder if someone more experienced might offer a view.
    Many thanks again to patixa, your kindness is greatly appreciated.

  • How can I use WebGLview in the iBook widget template in iAd producer?

    Recently I am trying to use iAd producer to create a iBook Author widget. What I need is to show a 3D .obj file in it. How can I do that? Is WebGL supported in the iBook Author template?

    Per iAd Producer help (https://help.apple.com/iadproducer/mac/5.0/index.html?localePath=en.lproj#/iade7 39fa44):
    Available in ad projects only.
    It was noted during an iBooks Author / iAd Producer seminar I attended that iBooks had not enabled WebGL content, so I encourage you to request support from Apple:
    http://www.apple.com/feedback/ibooks.html
    Alternatively, iBooks Author can present .obj files natively in their own widget:
    http://www.apple.com/ibooks-author/gallery.html#gallery-interactive-3d
    Obviously, the presentation is limited to the object and not any of the other interesting things you might be able to do with HTML and a WebGL object.
    Does that help?

  • I cannot get my add uploaded to iAd Workbench using iAd Producer

    I am using version 4.2 of iAd Producer and trying upload my add to iAd Workbench.
    I get the following error. Does anybody know how to resolve this error?

    They are not all on iTunes, I copied some over from my old Droid device when I bought the Nano,.  It was my understanding that there isn't a way to get those into iTunes.  Does having initially setup the Nano on a Windows machine have anything to do wish this?  I've switched to a Mac mini as the Windows machine is on life support.  I never had issues downloading from the Windows pc. 

  • How to create an "exit widget" button on iAd producer.

    I am creating a widget for a children's book and would like to create a simple "exit button" (an X the reader can touch to close the widget). Thus far I have created the object, but i can't seem to find an an 'action' to associate with the "activated" event that will close the widget and return to the iBook. I realise that a widget can alternatively be closed with a two-finger gesture, but for simplicity in view of my target audience prefer to have the "exit button". Note: I am relatively new to iBooks Author, and totally new to iAd producer. Unfortunately I don't know how to script in Java or HTML yet, but am willing to learn. Can anyone please give me some pointers?

    Thanks! The button didn't appear in the preview in iAd producer, so I didn't realize it was there. But I tried my widget in iBooks Author and the button is there. Thanks again!

  • I can't do anything in iAd Producer 4.1

    Hi there ,
    I have download an iAd Producer 4.1 . and when I trying to make some widgets for iBook Author (or any choices) the work space is disapear and I cant add any objects to it , and there is an error massage shown when trying to go back to overview that says : " there is an unexpected error occured " and it was closed from itself .
    I reinstall it again and again and same problem happened . and there is no older version of this app to try it.
    sorry for my english but I'm tired from searching for a solution and there is nothing .

    here is the logs in Console :
    ١٨/١١/٢٠١٣ ١٠:٤٦:٥١٫٨٥٠ م com.apple.SecurityServer[14]: Killing auth hosts
    ١٨/١١/٢٠١٣ ١٠:٤٦:٥١٫٨٥٠ م com.apple.SecurityServer[14]: Session 100056 destroyed
    ١٨/١١/٢٠١٣ ١٠:٤٧:١٦٫٥٤٩ م iAd Producer[1445]: Exception raised:
    NSImageCacheException
    Reason: Cannot lock focus on image <NSImage 0x608000c77e00 Size={0, 0} Reps=(
    )>, because it is size zero.
    User Info: (null)
    Build: 4.1 (4141)
    ١٨/١١/٢٠١٣ ١٠:٤٧:١٦٫٥٤٩ م iAd Producer[1445]: Backtrace: (
              0   CoreFoundation                      0x00007fff8f5c141c __exceptionPreprocess + 172
              1   libobjc.A.dylib                     0x00007fff8ef9de75 objc_exception_throw + 43
              2   CoreFoundation                      0x00007fff8f5c12cc +[NSException raise:format:] + 204
              3   AppKit                              0x00007fff97055329 -[NSImage _lockFocusOnRepresentation:rect:context:hints:flipped:] + 334
              4   AppKit                              0x00007fff970551c9 __51-[NSImage lockFocusWithRect:context:hints:flipped:]_block_invoke + 82
              5   AppKit                              0x00007fff97054626 -[NSImage _usingBestRepresentationForRect:context:hints:body:] + 170
              6   AppKit                              0x00007fff97054567 -[NSImage lockFocusWithRect:context:hints:flipped:] + 207
              7   AppKit                              0x00007fff971d7904 -[NSImage lockFocusFlipped:] + 123
              8   iAd Producer                        0x0000000101466df9 iAd Producer + 613881
              9   iAd Producer                        0x00000001013f7bfa iAd Producer + 158714
              10  iAd Producer                        0x00000001014eeea7 iAd Producer + 1171111
              11  iAd Producer                        0x00000001014eed32 iAd Producer + 1170738
              12  iAd Producer                        0x000000010171c587 iAd Producer + 3454343
              13  iAd Producer                        0x0000000101421807 iAd Producer + 329735
              14  iAd Producer                        0x0000000101421231 iAd Producer + 328241
              15  iAd Producer                        0x000000010142135a iAd Producer + 328538
              16  iAd Producer                        0x0000000101420f2c iAd Producer + 327468
              17  iAd Producer                        0x000000010171c36f iAd Producer + 3453807
              18  iAd Producer                        0x000000010161e6c2 iAd Producer + 2414274
              19  iAd Producer                        0x000000010171bf14 iAd Producer + 3452692
              20  iAd Producer                        0x000000010171bc7f iAd Producer + 3452031
              21  iAd Producer                        0x00000001014eeb8b iAd Producer + 1170315
              22  AppKit                              0x00007fff971773d0 -[NSApplication sendAction:to:from:] + 327
              23  AppKit                              0x00007fff9717724e -[NSControl sendAction:to:] + 86
              24  AppKit                              0x00007fff971c3d7d -[NSCell _sendActionFrom:] + 128
              25  AppKit                              0x00007fff971dd715 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 2316
              26  AppKit                              0x00007fff971dcae7 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 487
              27  ProKit                              0x0000000101c5b3cc -[NSProButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 504
              28  AppKit                              0x00007fff971dc1fd -[NSControl mouseDown:] + 706
              29  iLifeKit                            0x000000010231f353 -[IPKButton mouseDown:] + 371
              30  AppKit                              0x00007fff9715dd08 -[NSWindow sendEvent:] + 11296
              31  iAd Producer                        0x00000001015d9b81 iAd Producer + 2132865
              32  AppKit                              0x00007fff970fc744 -[NSApplication sendEvent:] + 2021
              33  AppKit                              0x00007fff96f4ca29 -[NSApplication run] + 646
              34  AppKit                              0x00007fff96f37803 NSApplicationMain + 940
              35  iAd Producer                        0x00000001013d2c64 iAd Producer + 7268
    ١٨/١١/٢٠١٣ ١٠:٤٧:١٧٫٨٣٧ م iAd Producer[1445]: CGSNewCIFilterByName
    ١٨/١١/٢٠١٣ ١٠:٤٧:١٧٫٨٣٨ م iAd Producer[1445]: CGSNewCIFilterByName failed: error 1006
    ١٨/١١/٢٠١٣ ١٠:٤٧:٢٠٫٣٥٣ م iAd Producer[1445]: -[STProjectFile writeSafelyToURL:ofType:forSaveOperation:error:](STProjectFile.m:285) Got error Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “Untitled (Autosave).iadproj”." UserInfo=0x600000a738c0 {NSFileOriginalItemLocationKey=file://localhost/Users/majedsaud/Library/Contain ers/com.apple.iAdProducer/Data/Desktop/Untitled%20(Autosave).iadproj, NSURL=file://localhost/Users/majedsaud/Library/Containers/com.apple.iAdProducer /Data/Desktop/Untitled%20(Autosave).iadproj, NSFileNewItemLocationKey=file://localhost/private/var/folders/w0/9r22h60j2sj8qd qzk0_j75x80000gn/T/com.apple.iAdProducer/TemporaryItems/(A%20Document%20Being%20 Saved%20By%20iAd%20Producer%207)/Untitled%20(Autosave).iadproj, NSUnderlyingError=0x600000a5fc80 "You don’t have permission to save the file “Untitled (Autosave).iadproj” in the folder “(A Document Being Saved By iAd Producer 7)”."} trying to replace /Users/majedsaud/Library/Containers/com.apple.iAdProducer/Data/Desktop/Untitled (Autosave).iadproj with /private/var/folders/w0/9r22h60j2sj8qdqzk0_j75x80000gn/T/com.apple.iAdProducer/ TemporaryItems/(A Document Being Saved By iAd Producer 7)/Untitled (Autosave).iadproj
    ١٨/١١/٢٠١٣ ١٠:٤٧:٢٠٫٤١٣ م sandboxd[291]: ([1445]) iAd Producer(1445) deny file-write-create /Users/majedsaud/Desktop/Untitled (Autosave).iadproj
    ١٨/١١/٢٠١٣ ١٠:٤٧:٢٠٫٥٤٥ م com.apple.launchd.peruser.501[163]: (com.apple.iAdProducer.30832[1445]) Exited with code: 1

  • Making variables global i iAd Producer

    sorry if this is a really simple question. Still, I am stuck:
    I would like to have widgets access other widget's variables. I would have thought, for instance, that it would be possible to declare a variable
    var Utility = this.viewController.outlets.Utility;
    in Global.js, refering to a widget declared in one of the standard auxiliary (.js) files.
    I assume that there are more clever ways of doing this. I'm not new to programming, but I'm new to both iAd Producer and JavaScript.
    Any and all pointers welcome.
    Thank you,

    For security reasons, each widget in an iBooks Author book can only access it's own content.
    If you meant sharing across pages in a project, then Global.js is the place to store the variables. It's best to assume Global.js can NOT see anything on individual pages, so your idea of using "this.viewController…" likely won't work. Instead, define your Utility class in Global.js (or in another JavaScript file you added as an asset), and reference the objects therein directly from the code in your pages.
    Does that help?

  • Sliders for iBook's widget built in iAd producer

    I am attempting to build a widget that features sliders (general object) for iBooks in iAd producer. I added sliders in iAd Producer; have a minimum setting of 0.0, maximum of 10, and moving at increments of 0.5. I tested them in the preview funciton in iAd and the knobs on the sliders can be dragged up and down (at increments 0.5 becuase that is what I set it at), but when I export to a widget and drop it into an iBook and preview it, I lose the funciotnality of the knobs in the sliders. I can't drag the knobs back and forth anymore. Does anyone know why? Perhaps I missing an action...?

    Works for me. Have you hooked in any code that may be causing a problem?
    I dropped a slider and a label on a page then selected the slider and clicked the code button then selected to overrride the Did Change Value event handler and added the follwoing code:
    this.onControlValueChange = function (event) {
              // Code here for the "Did Change Value" event.
        var label = this.viewController.outlets.label;
        label.text = this.value;
    I can slide the knob and the label updates as expected.  I did need to tap the widget before I could intereact with it in an iBook but otherwise it works the same for me in an iBook on the device as it does in preview.
    Any other clues?
    -Mark

  • Drag and drop iAd Producer

    hi everyone.
    Anyone can help me with iAd Producer...
    I'm doing widgets for iBooks
    I want to do drag and drop objects, and add some effects  as possible.
    Anyone know how it works?
    Thanks a lot!

    A friend (who is more of a JS jockey than I) created a similar project. Here's how he did it.
    For each draggable object, he added three event handlers:
    Touched Down
    Touch Dragged Inside
    Touched Up Inside
    These can be added by selecting the object and changing the Inspector's INTERACTION > Events brick > + {event} > Execute JavaScript, or by using the menu, Code > Object Events > {event} > Execute JavaScript.
    His code looked something like this:
    // Define CLOSE_X_MIN, CLOSE_X_MAX, CLOSE_Y_MIN and CLOSE_Y_MAX to be
    // "close enough" to the target drop zone.
    this.onViewTouchDragInside = function (event) {
      var p = iAd.Point.fromEventInElement(event, this.layer.parentElement);
      p.x -= this.startTouchPoint.x;
      p.y -= this.startTouchPoint.y;
      p.x += this.startPosition.x;
      p.y += this.startPosition.y;
      this.position = p;
    this.onViewTouchUpInside = function (event) {
      object_pos = this.position
      window.theposition = object_pos;
      var x = object_pos.x;
      var y = object_pos.y;
      if ((x >= CLOSE_X_MIN && x <= CLOSE_X_MAX) && (y >= CLOSE_Y_MIN && y <= CLOSE_Y_MAX)) {
        // close enough, right answer
        x = ((CLOSE_X_MAX + CLOSE_X_MIN) / 2);
        y = ((CLOSE_Y_MAX + CLOSE_Y_MIN) / 2);
        var p = new iAd.Point(x,y);
        this.position = p;
    this.onViewTouchDown = function (event) {
      var p = iAd.Point.fromEventInElement(event, this.layer.parentElement);
      this.startPosition = this.position.copy();
      this.startTouchPoint = p;

  • IAd producer and html5 canvas

    I am familiar with producing iAds using JavaScript but have hit upon a problem when using the HTML place holder from the 'Dynamic Content' section.
    I have set up the htmlView.html file with the following code:
    <div><canvas width="1000" height="600" id="mywizzycanvas"></canvas>
    <script>
    var can = document.getElementById('mycanvas');
    var ctx = can.getContext('2d');
    </script>
    </div>
    and have then used sliders to draw to the canvas.
    The iAd works perfectly when previewed in iAd Producer, it works perfectly when previewed in Safari, but when exported to the .wdgt format and placed in an iBook the sliders cease to work. I have tried exporting the iBook but still nothing. I would be very grateful for any help or assistance with this.

    Many thanks for your reply patixa. Apologies for my incorrect typing of IDs, in my iAd code they do match.
    I have managed to resolve the problem as follows:
    All of my iAd content was originally on the Background layer. Placing the content on Page1 has resolved the problem.
    I'm not certain as to why the project worked in iAd producer preview/Safari/Widget preview but not in iBooks but no matter, switching to Page 1 solves it completely.
    I notice from a few of the problems people have posted that they have a similar situation and wonder if this might be something that would help them. I've not posted replies but wonder if someone more experienced might offer a view.
    Many thanks again to patixa, your kindness is greatly appreciated.

  • Handling Device Orientation in iAd Producer

    Hi,
    I'm almost on the final stage of my iAd project and I'm using the iAd Producer. The only thing left is handling device orientation. When I change the view of my project from Portrait to Landscape, some objects gets cutoff. My question is how to properly handle the orientation. I thought of creating a new page with the view set to Landscapre (while the other is Portrait) but I am not sure if that's the right way (i haven't tested it yet).
    Or is there any JS code that needs to be done? I appreciate guiding me on that part if that is so.
    Thanks in advance!
    Mark

    Feel free vary the orientation on a page-by-page basis however most ads pick an orientation and stay with it.
    -Mark

  • I'm trying to upload my ad from iAd producer but i get an error

    I'm trying to upload my ad from iAd producer but i get that error "This account does not have access to the iAd server." why?
    I also tried to access the website of iAd creative management but when i try to login, the page come back to the login page (so i can't access!)
    Help me please!

    Uploading is available for Advertisers and Agencies with an iAd Account Manager.  If you've got an account manager, they can flip the switch for your Apple ID.
    If you do not have an account manager, select the Contact Us link in the sign-in dialog.
    Cheers,
    -Mark

  • Creating a youtube widget in iAd Producer for Ibooks Author

    Hello,
    I am trying to create a widget in iAd Producer to add to my iBooks Author template featuring a youtube video.
    I am able to create and save the widget but when I place it into iBooks Author template I get a large gray box with a small black box in the center (the video). 
    Is there a way to correct this? 
    How can I eliminate the outer frame? 
    Any other suggestions on adding a youtube video to iBooks Author?
    Thank you.

    See my answer in:
    https://discussions.apple.com/message/24985089

  • IAd Producer download Access Denied

    I have a iOS developer account and i want to download the iAd Producer but it keeps telling me Access Denied.
    And i cant find any refrence how and why i cant download it.
    Any tips/links?

    Please send a message to [email protected] to have them take a look.  You may also download iAd Producer from the downloads site at developer.apple.com/downloads
    -Mark

  • Compose Email from iAd Producer iBooks Widget

    I am looking for a simple way to email the content of my text fields/forms from my widget I am creating from the new iAd Producer. I've read that there is a "compose email" action, however, in the iBooks Author Widget creator I can't seem to find it. Any help would be appreciated.

    I've since found that the compose email action is available for the iOS but not for the iBooks author?

Maybe you are looking for