Created
January 4, 2012 20:16
-
-
Save davidortinau/1561886 to your computer and use it in GitHub Desktop.
Backbone View with SWF embed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ThisLife.ImportTemplate = _.template(' | |
| <!-- omitting a bunch of html --> | |
| <div id="no_flash_detected"> | |
| <div class="top"> | |
| <h3 class="jeff_script">No Flash Detected</h3> | |
| </div> | |
| </div> | |
| <script type="text/javascript"> | |
| function flashReady(){ | |
| return $.cookies.get("sessionToken"); | |
| } | |
| </script> | |
| <!-- omitting a bunch of html --> | |
| ') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ThisApp.View.ModalImport = Backbone.View.extend | |
| el: $('#tl_import_modal_wrap') | |
| events: | |
| # omitted a bunch of events | |
| "flashReady #no_flash_detected" : "flashReady" | |
| initialize: -> | |
| @personModel = ThisApp.Model.getPersonInfo | |
| @render() | |
| render: -> | |
| $(@el).html ThisApp.ImportTemplate( person: @personModel ) | |
| this | |
| embedSWF: -> | |
| if swfobject.hasFlashPlayerVersion("9") | |
| currentSubdomain = ThisApp.Model.getCurrentLife().subdomain | |
| flashvars = | |
| environment: "staging" | |
| subdomain: currentSubdomain | |
| params = | |
| quality: "high" | |
| wmode: "opaque" | |
| bgcolor: "#f9f9f9" | |
| allowfullscreen: "true" | |
| allowscriptaccess: "always" | |
| attributes = | |
| name: "uploader" | |
| styleclass: "sauploader" | |
| align: "middle" | |
| swfobject.embedSWF "StandaloneUploader.swf", "no_flash_detected", "100%", "100%", "9.0.0", false, flashvars, params, attributes | |
| else | |
| $("#uploader_loading").hide() | |
| flashReady: -> | |
| console.log 'flashReady YES' | |
| $.cookies.get("sessionToken") | |
| topBarLinks: (e) -> | |
| # omitted code | |
| switch e.currentTarget.parentNode.id | |
| when 'tl_import_top_desktop' | |
| show('#tl_modal_import_desktop') | |
| $("#tl_modal_import_desktop .tl_modal_import_step").show() | |
| @embedSWF() | |
| # ommitted the rest of the file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TestView = Backbone.View.extend({
});
function pageInit() {
testView = new TestView();
}
Using the global 'testView' you can call testView.trace from ActionScript
TestView = Backbone.View.extend({
});
new TestView();
function pageInit() {
console.log("pageInit");
//testView = new TestView();
}
function sendToJavaScript(value) {
$('#home').triggerHandler('flashready', value);
}
Call sendToJavaScript from ActionScript.