0

Problem with event handlers

Hi guys,

I’m having huge trouble with detecting what I can and I can’t use from JavaScript on large canvas page.

To illustrate my problem I’ve made test application that contains just basic code – for start I want to attach simple onclick listener. Here is basic page that works -> http://173.1.133.34/Yap/test/yaptest.aspx

However, when I try that same page from YAP wrapper – no event is risen - http://apps.yahoo.com/-HssKJa7g/YahooFullView/

I will appreciate any kind of help you can provide.

by
2 Replies
  • Hi kape123,

    The problem is actually not with the event handlers but with the alerts. Under caja, alert will be converted to a console.log in Firefox and output via firebug. When I look at your sample app I see the events firing in the Firebug console, so your events are working fine.

    Let me know if you have any issues along the way.

    Jonathan LeBlanc
    Technology Evangelist
    Yahoo! Developer Network
    Twitter: @jcleblanc
    0
  • QUOTE (Jonathan LeBlanc @ Mar 5 2010, 01:32 PM) <{POST_SNAPBACK}>
    Hi kape123,

    The problem is actually not with the event handlers but with the alerts. Under caja, alert will be converted to a console.log in Firefox and output via firebug. When I look at your sample app I see the events firing in the Firebug console, so your events are working fine.

    Let me know if you have any issues along the way.

    Jonathan LeBlanc
    Technology Evangelist
    Yahoo! Developer Network
    Twitter: @jcleblanc


    First of all - thanks a lot for your help... it means a lot when you can talk with someone who has experience on something you are just starting with.

    Now that you are telling me that event handlers work - main question - how can I play sounds? I've updated example to create sound player and again - it works directly, now over YAP shell. I've also tried to make use of yml:audio, but it throws error (in YAP shell) in that case. Also, before using this player I've used SoundManager2, but ditched it because it has complicated JavaScript+Flash initiallization and in documentation I've read that YAP cajoles those kind of stuff.

    Thanks again for your help!
    0
  • Just to make it easier; URLs are again:

    works -> http://173.1.133.34/Yap/test/yaptest.aspx
    not working -> http://apps.yahoo.com/-HssKJa7g/YahooFullView/
    0
  • No worries - glad to help. This new issues appears to be due to embedding a flash object in the page. <object> / <embed> tags are restricted under caja but we have an alternative. <yml:swf> (http://developer.yahoo.com/yap/guide/swf.html) is used to embed flash securely on your application and can be used as an alternative. Now, if you try to insert <yml:swf> in the page on a user click event there will be another issue. yml:swf will be stripped out by the run-time cajoler (runs when code is inserted in the app after the page loads) because it is a very strict parser, so you have a few options:

    1. Hide the yml:swf tags using display:none and then show them when the user makes a click action

    2. Use yml:a (http://developer.yahoo.com/yap/guide/a.html) with the insert parameter to run an ajax request to load in the yml:swf tag from another file. yml:a can safely transport yml:swf and render it.

    Let me know if that doesn't solve the issue.

    - Jon
    0

Recent Posts

in YAP