millthorpe

Q: 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.

Posted on Mar 17, 2015 12:10 PM

Close

Q: iAd producer and html5 canvas

  • All replies
  • Helpful answers

  • by patixa,Helpful

    patixa patixa Mar 18, 2015 11:36 AM in response to millthorpe
    Level 3 (597 points)
    Mar 18, 2015 11:36 AM in response to millthorpe

    Based on your provided code sample, your IDs don't match, i.e. "mywizzycanvas" vs. "mycanvas".

  • by millthorpe,

    millthorpe millthorpe Mar 18, 2015 11:47 AM in response to patixa
    Level 1 (10 points)
    Mar 18, 2015 11:47 AM in response to patixa

    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.

  • by kiotsukete,Helpful

    kiotsukete kiotsukete Mar 26, 2015 12:47 AM in response to millthorpe
    Level 1 (20 points)
    Mar 26, 2015 12:47 AM in response to millthorpe

    if building for iBooks Author, always, always preview the widget in the page in iBooks Author on the iPad to make sure it's working as you want it. Don't rely on iAd previews or even iBooks Author's own internal preview. Export it to the book and then preview the book on the device the user will be viewing it on.

  • by millthorpe,

    millthorpe millthorpe Mar 29, 2015 5:49 AM in response to kiotsukete
    Level 1 (10 points)
    Mar 29, 2015 5:49 AM in response to kiotsukete

    Many thanks kiotsukete, very wise advice to follow, particularly before investing too much time in a particular project.

     

    In addition to my comments above, selecting the option in iAd Producer to 'Export to Disk (Optimised)' ensured that the project worked even in preview mode for iBooks Author.

     

    Thank you again to both patixa and kiotsukete for their help.