define('DISALLOW_FILE_EDIT', true); Javascript – unFocus Projects – Kevin Newman and Ken Newman http://www.unfocus.com Home of Scripts 'n Styles for WordPress, Backstage2D and History Keeper! Sat, 09 Jan 2016 20:44:11 +0000 en-US hourly 1 https://wordpress.org/?v=6.2.5 Introducing Quint Dice! http://www.unfocus.com/2016/01/09/introducing-quint-dice/ http://www.unfocus.com/2016/01/09/introducing-quint-dice/#respond Sat, 09 Jan 2016 19:54:53 +0000 http://www.unfocus.com/?p=4459 Continue reading "Introducing Quint Dice!"]]> I’ve been working on a game for the last few months in spare time. It’s a dice game called Quint Dice, a social dice game. What makes this different from so many dice games out there is that it’s based on dice that have color pairs, and you can play it with more than two players.

What I’d like to avoid with Quint Dice is pay to win forms of revenue. Currently there are no bonus rolls. I’ll eventually add some, but you won’t be able to buy them or stock pile them to gain advantage over your opponents. I think I’ll add one bonus roll per game, and if you don’t use it in that game it goes away. I may also add a second bonus type – an extra dice. The idea is to add a level of strategy and flexibility to the play, without allowing a fundamental shift in advantage for one player or another just because they paid for an advantage.

The only revenue source built into the game at launch is a small banner ad at the bottom. I’d also like to add custom dice packs, and maybe some full on themes. I’m hoping this will be enough to turn this into something that pays for itself. I may also play with interstitial ads, but only as a voluntary way to earn points to buy custom dice packs and themes without shelling out cash, for users who prefer that route. I like this better than pestering players with involuntary interstitial ads as a way to get them to pay. Annoying players is not my favorite model, no matter how common it is in mobile gaming. Finally, there will eventually be an option to remove the ads.

I built Quint Dice with Meteor and React, and I would like to eventually port to React Native, but I’m using Cordova for the time being on Android and iOS (soon!). Like so many of the projects I play with under the unFocus banner, this has mostly been a learning exercise. But I’m happy with the results, and thought I should probably dust off this blog, and may start to share some thoughts I have as I develop these things.

To kick that off, I’ll share a couple of things I learned while getting this out the door, in no particular order. If you’d like to know more about any of these items, please leave a comments, and I’ll see about writing a follow-up post.

  • Facebook integration is easy/hard. Getting notifications to work seems pretty easy, but getting a canvas app to work posses some challenges, particularly where advertising is involved. You can’t use AdSense inside an iframe, which is needed for FB canvas. Instead you’ll need to go with one of Facebook’s approved ad vendors. They all have that institutional feel to them, if their websites can even be reached. Not a fantastic dev experience. The solution I’ll probably go with is to create a Facebook canvas based landing page, and then flow my users to my domain from there, instead of having them play within the canvas page.
  • Meteor’s accounts system is awesome! With very little effort you can get up and running with a full accounts system, and there are a ton of Meteor packages to expand functionality. I ended up building custom UI in the end, but to get started I used the off the shelf accounts-ui, so I didn’t have to wait. I’ll probably be using a link accounts package to add the ability to associate facebook, google+ and maybe other third-party accounts services (Amazon perhaps) to existing Quint Dice accounts. I may also use an account merge package to make it so users can merge their accounts if they accidentally sign up with two different auth sources and want to combine their accounts into one. There are two different packages for that – and these are the kinds of things that make Meteor so fantastic! I can’t think of another platform where something like that is so easy to set up. Setting this up has some interesting challenges in terms of user flow, and it’s probably worthy of a blog post or two.
  • My on boarding process is a mess in the current iteration. I hope to fix that with the above mentioned packages link and merge packages. I may also play around with having an anonymous user for anyone who comes to the site and is not logged in. That way they can just get started.
  • Finding players is another messy area so far. I basically only collect one bit of information from users – a username. To start a game with other players, you are presented with a giant list of every player. This clearly needs work. Eventually I’d like to add Facebook friend support, and maybe even a friends list internal to Quint Dice. I’ll also add more profile data and some way to search on that (this is on my short list).
  • Push notifications are relatively easy to set up on Android. Relatively more complicated on iOS, but I should have that out soon (this is the only thing hold up an iOS release). I did figure out how to get a nice black and white notification icon to work, and that maybe warrants its own blog post (see this Meteor forums post for now). I’m using raix:push package in Meteor for that.
  • Meteor’s React support is build around a React Mixin, which basically wraps a single method on a component to make it reactive. This makes sense given that Meteor typically doesn’t enforce any kind of application architecture on the developer (a good thing IMHO), but I will probably switch to using something more Flux like. For non-reactive data sources and application state, I’m already using a Flux like pattern/architecture (using SignalsLite.js), but I may look into something like Reflux (or maybe Redux, or Alt) and then figure out how to move my reactive Meteor handling to that level. This probably warrants a blog post or two.
  • I used Adobe Animate CC to create the animated dice roller (output as HTML5 Canvas of course). CreateJS is pretty sweet, even on mobile. I may experiment with OpenFL for new dice packs, and see how well that runs. I’m thinking that custom dice packs will stay in HTML5, even if I eventually transition to React Native, so that they can be truly cross-platform. The only challenge with that might be an eventual port to Apple Watch, and AppleTV, which don’t support WebViews. I’m curious though if there is a way to use the JS behind my canvas based mini-apps, and render that through some HTML5 canvas wrapper from within a JavaScriptCore instance (is JSCore on Apple WatchOS and Apple TVOS?). When I figure this out, I’ll almost certainly blog about it. Of course, I may not even need all that if I go with OpenFL, because they have a native c++ compiler.

Going forward, I’ll try to post more, probably when I make an update. There are a ton of other important packages (aldeed:simple-schema and aldeed:collection2) and technologies to cover, and I’m sure I’ll mention them eventually.

]]>
http://www.unfocus.com/2016/01/09/introducing-quint-dice/feed/ 0
HiDPI/Retina for CreateJS (Flash Pro HTML5 Canvas) http://www.unfocus.com/2014/03/03/hidpiretina-for-createjs-flash-pro-html5-canvas/ http://www.unfocus.com/2014/03/03/hidpiretina-for-createjs-flash-pro-html5-canvas/#comments Tue, 04 Mar 2014 00:25:12 +0000 http://www.unfocus.com/?p=4365 Continue reading "HiDPI/Retina for CreateJS (Flash Pro HTML5 Canvas)"]]> Adding HiDPI and Retina screen support to a CreateJS (Flash HTML5 canvas publish with EaselJS) is easy enough. Just add this code after where the stage is defined in your published html file (either inside the generated init function, or handleComplete if there are external assets to load):

[js]
if (window.devicePixelRatio) {
// grab the width and height from canvas
var height = canvas.getAttribute(‘height’);
var width = canvas.getAttribute(‘width’);
// reset the canvas width and height with window.devicePixelRatio applied
canvas.setAttribute(‘width’, Math.round(width * window.devicePixelRatio));
canvas.setAttribute(‘height’, Math.round( height * window.devicePixelRatio));
// force the canvas back to the original size using css
canvas.style.width = width+"px";
canvas.style.height = height+"px";
// set CreateJS to render scaled
stage.scaleX = stage.scaleY = window.devicePixelRatio;
}
[/js]

IE 10 doesn’t support devicePixelRatio, but you can get a resonable devicePixelRatio with this (include it before your CreateJS script, and call window.getDevicePixelRatio() instead of using the standard property):

[js]
/*! GetDevicePixelRatio | Author: Tyson Matanich, 2012 | License: MIT */
(function (window) {
window.getDevicePixelRatio = function () {
var ratio = 1;
// To account for zoom, change to use deviceXDPI instead of systemXDPI
if (window.screen.systemXDPI !== undefined && window.screen.logicalXDPI !== undefined && window.screen.systemXDPI > window.screen.logicalXDPI) {
// Only allow for values > 1
ratio = window.screen.systemXDPI / window.screen.logicalXDPI;
}
else if (window.devicePixelRatio !== undefined) {
ratio = window.devicePixelRatio;
}
return ratio;
};
})(this);
[/js]

If you like to load your CreateJS based animation in an iframe (I do) and the canvas content is the only content, you may also want to add some styles to avoid scrollbars and extra padding:

[css]
body {
margin:0;
padding:0;
}
canvas {
display: block;
}
[/css]

Before making these edits, I recommend copying the main html page, so that you don’t have to worry about the publisher wiping out your changes when you publish again (if certain things change, you may need to reintegrate your changes).

Some Notes:

  • Some (slightly) older versions of Safari on OSX with Retina screens seemed to automatically apply a pixel doubling to canvas elements, so this might be redoubling again (I’m really not sure). It doesn’t seem to do this in the latest version though.
  • If you use “cacheAsBitmap” the content will be cached at the normal resolution. If you can find the place in code where that’s being set, you can actually apply the devicePixelRatio multiplier there by passing it in as a variable to the function that sets CAB, but CreateJS does not do this by default.

Relevant info for devicePixelRatio and supporting HiDPI / Retina displays

]]>
http://www.unfocus.com/2014/03/03/hidpiretina-for-createjs-flash-pro-html5-canvas/feed/ 5
A Simple State Manager for History Keeper http://www.unfocus.com/2010/08/26/a-simple-state-manager-with-history-keeper/ http://www.unfocus.com/2010/08/26/a-simple-state-manager-with-history-keeper/#respond Thu, 26 Aug 2010 16:33:58 +0000 http://www.unfocus.com/?p=498 Continue reading "A Simple State Manager for History Keeper"]]> Someone asked how to store a key value pair in HistoryKeeper recently, and this was my answer.

History Keeper does not provide any state management features beyond the information you store on the actual deep link (URL hash). However, you should be able to use the deep link information to grab the data you need out of a standard JS object (using it like a hash table):

[cc lang=”javascript”]
var storage = {
“/”: {
key: “home value”
},
“/about”: {
key: “about value”
}
};
[/cc]

Once you have your values stored like that you can use the storage object to lookup your chunk of data by the deep link string:

[cc lang=”javascript”]
function onHistoryChange(hash) {
alert(storage[hash].key);
}
unFocus.History.addEventListener(‘historyChange’, onHistoryChange);
[/cc]

You can make the “value” as deep as you want ( key: {more: “complex”} ), I only used a simple string for demonstration purposes.

This example is JavaScript, but the concepts are the same for Actionscript as well.

I hope that helps!

]]>
http://www.unfocus.com/2010/08/26/a-simple-state-manager-with-history-keeper/feed/ 0
Trace Actionscript in a Browser http://www.unfocus.com/2009/11/10/trace-actionscipt-in-a-browser/ http://www.unfocus.com/2009/11/10/trace-actionscipt-in-a-browser/#comments Tue, 10 Nov 2009 06:57:09 +0000 http://www.unfocus.com/?p=318 Continue reading "Trace Actionscript in a Browser"]]> Testing Flash apps in a browser can be cumbersome, but it needs to be done for some browser only functionality, such as deep linking and back button functionality – as well as checking other things that might change once you are out of the Flash “test movie” sandbox, and into the browser – things like file path issues. The convenient trace window is not available in the browser, but there are alternatives.

Flash Content Debugger and “Allow Debugging”

While it’s not essential for tracing, the first thing you should do, is make sure you are running a content debugger version of the Flash Player. You need both the Active X version for IE, and the Plugin version for everyone else (Firefox, Chrome, Opera, Safari, etc.). Both plugin types have their quirks with regards to JavaScript (and other platform differences), and really require specific testing in each, so make sure you grab both versions. Once you have those, you’ll be able to see uncaught exceptions in AS3 swfs right in the browser. You can even use the Flash Content Debugger from the browser, though I haven’t found a smooth way to do that yet. For many thing, a simple trace is all you need.

A quick tip that took me a while to notice – the “Allow Debugging” checkbox in Flash’s Publishing Settings dialog, actually causes the Flash compiler to add debugging symbols to the compiled swf, symbols that give you useful information like the actual line number of an error, in addition to the stack trace. The “Allow Debugging” verbiage, is most definately not enough to communicate that difference – I thought it was more of a locking mechanism. Hopefully you haven’t stumbled around for too long with that, like I did when I first switched to AS3..

Tracing

The easiest way to trace from Flash is to use Firefox with the FlashTracer extension from sephiroth.it. With FlashTracer, you can use the regular old built in trace method without any extra work on your part. Make sure you download the one from sephiroth.it (2.3.1), since the one from addons.mozilla.org (2.2.0) doesn’t work in Firefox 3.5. For many things that’ll be all you need. But sometimes, you’ll need information in other browsers, and will want to trace to the browsers JavaScript console. In addition to simple trace messages, you can also call a number of other methods that will out put your messages in different formats and colors, making it easier to spot what you might be looking for.

Check out the Firebug Console API for more information.

Enabling the JavaScript console

If you are already familiar with the various JavaScript consoles, please feel free to skip to this part.

Each of the major browser vendors has a JavaScript console implementation, and thankfully, the API is mostly compatible with one another. The GUI is a bit different in each (except Safari and Chrome – both are based on WebKit), so here’s a quick rundown on how to access the JavaScript console for each:

Firefox

You should get to know and love Firebug. It is currently the best developer tool available on any platform – so good the others all copied it, even if they won’t admit it (*cough*Microsoft*cough*). Firefox is oddly enough, the only browser that doesn’t ship with a JavaScript console, and requires you to install an extension. While running Firefox, you can find and install that extension at www.getfirebug.com.

Once Firebug is installed, you will notice a little bug (insect) icon in the bottom right hand corner of the browser window, on the status bar. Click that to open and enable Firebug for the page you are currently viewing. Firebug will only turn itself on, on a site by site basis, and only after you click on that bug icon. Once it has popped open, you will see some tabs, with many goodies like the fabulous “Net” tab (very useful to make sure swfs are being loaded in the browser), and the “HTML” tab, which contains a live, nested version of your html code, which can be edited in real time – it’s hard to describe how much better life is in the Web Development since Firebug. Anyway, the tab we are interested in, is the “Console” tab – click that. On the actual tab, there will be a little down arrow – click that to open a menu, then click “Enabled” to turn the console on (the onscreen instructions are a little odd, their picture is of the “Script” tab – the arrow you want is on the “Console” tab, not the “Script” tab).

Internet Explorer

You’ll need to upgrade to IE8. If you are stuck on IE6, I’m sorry for you. You will not be able to easily debug Flash apps – that browser is simply difficult to work with, and you’ll probably need to output to either a text field within flash, or to a div element using JavaScript. Go and download IE8 now, if you don’t already have it. Once you have IE8 installed, you can find the “Developer Tools” under “Tools” menu. You can also press F12 to bring them up. The dev tools in IE8 are docked to the main window, along the bottom of the screen, very much like Firebug. You will notice 4 tabs in a blue bar, below a row of link buttons – click the “Script” tab to open the script tools. You will have two panes at that point – in the left is a debugger, and in the right pane, you should see a button for the Console.

Safari

You’ll need to enable the developer tool first, before you can turn on the JavaScript console. Click on the gears icon on the main toolbar, and choose “Preferences”, then click the “Advanced” tab (the one with the gear icon). On that page, there is a checkbox labeled “Show develop menu in menu bar”. Check that, and close the window. Now under the Page icon menu, you’ll see a sub menu called “Develop”. In that sub-menu, choose “Show Error Console”. This will open the “Web Inspector” window. You can dock the window along the bottom of the main window by clicking the dock button in the bottom left of the Web Inspector window. To the right of that button, there is another button with a greater than sign, and three lines. That button will toggle the JavaScript console.

Chrome

Click the page drop down icon on the right of the main toolbar to open the main menu, then go to Developer, then JavaScript console. This will open the “Developer Tools” window, which contains the many things, including the JavaScript console. You can dock window inside of the main window by pressing the dock button on the bottom left of the popup window. To the right of that button, there is another button with a greater than sign, and three lines. That button will toggle the JavaScript console for Chrome.

Opera

Under the Tools menu, choose the “Advanced” submenu, then choose “Developer Tools”. This will open a panel along the bottom of the main window (sensing a trend here?). In that panel, click on the “Error Console” tab. If you’d like to only see JavaScript errors, you can click the bottom JavaScirpt tab (under the white output area of the Error Console). Note: Their is an alternative “Error Console” under Tools -> Advanced -> Error Console. Try them both, and use the one you prefer.

Tracing to the Console

Once you have familiarized yourself with the JavaScript console, you can start to trace to it. The JavaScript command is simple enough:

[cc lang=’javascript’ ]
window.console.log(“your message”).
[/cc]

From Actionscript you’ll need something like this:

[cc lang=’actionscript’ ]
import flash.external.ExternalInterface;
ExternalInterface.call(“console.log”, “your message”);
[/cc]

Since we are using ExternalInterface, you’ll need to make sure you have the allowScriptAccess object param, or embed attribute set to an appropriate value – either “always” or “sameDomain” (sameDomain is the default, so as long as you have your html/javascript/swf all on the same domain, you should be good to go).

You should now be able to trace (or something like it) in the browser. Next time I’ll cover some more advanced uses, as well as some more specific snafus with deep linking and browser back button functionality.

]]>
http://www.unfocus.com/2009/11/10/trace-actionscipt-in-a-browser/feed/ 3
jQuery.historyKeeper http://www.unfocus.com/2009/09/11/jquery-historykeeper/ http://www.unfocus.com/2009/09/11/jquery-historykeeper/#comments Fri, 11 Sep 2009 18:59:23 +0000 http://www.unfocus.com/?p=272 Continue reading "jQuery.historyKeeper"]]> unFocus History Keeper is a JavaScript based library for managing browser history (back button) and providing support for deep linking for Flash and Ajax applications.

What I’m proposing is taking History Keeper and making a jQuery plugin, and also a WordPress plugin to include the History Keeper library for use in WordPress. I am primarily interested in this for the process of it: to learn more about making plugins.

]]>
http://www.unfocus.com/2009/09/11/jquery-historykeeper/feed/ 1
unFocus.History Keeper 2.0 (and SwfHTML) Beta 4 – Out Now! http://www.unfocus.com/2009/07/10/unfocus-history-keeper-2-0-and-swfhtml-beta-4-%e2%80%93-out-now/ http://www.unfocus.com/2009/07/10/unfocus-history-keeper-2-0-and-swfhtml-beta-4-%e2%80%93-out-now/#comments Fri, 10 Jul 2009 06:16:23 +0000 http://www.unfocus.com/?p=223 Continue reading "unFocus.History Keeper 2.0 (and SwfHTML) Beta 4 – Out Now!"]]> A brand spanking new Beta 4 of unFocus.History Keeper is out, and ready for download! Download it from Google Code. (If you are wondering what happened to Beta 3 – I actually rolled that update about half way, and had it sitting in SVN for a while, but I never made the archive, or release notification.)

Sloppy change log:

Fixed Flash Player 10 PlugIn detection.
Changed license to MIT
Quick and dirty temp IE8 support (makes IE8 use the timer method).
– removed ObjectPatentMagic
– added Packed library files for Beta 4 (says RC1 in SVN, but I changed my mind, there’s more I’d like to add).
– Added svn:keywords to most files.
– Updated tests for EventManager, FlashPlayerInfo, HistoryKeeper, SwfHTML and SwfShim.
– removed WebTV code, since the entire FlashPlayerInfo script doesn’t work in WebTV anyway.
– Fixed Issue 5. Added methods for major, minor and bugfix versions, to reflect changes to the convention in Flash Player 10 – Also cleaned up issues releated to the changes in IE.
– Added getUpdateVersion for the special case Flash Player 9 updates.
– Quick fix for shimMode on SwfShim.
– Fixes IE support.
– Adds shimMode property (it’s off by default).
– Fixed typo in call to get initial hash value (deep link), which broke it.
– Updates to the HistoryKeeper Actionscript 3.0 files. These changes are generally significant.
– Added asdocs comments (to AS3 files).
– Added support for Opera’s history.navigationMode.
– Made IE8 Hack detection more robust, and IE detectin simpler.
– Initial commit of Actionscript HistoryKeeper and AS3->JS communication framework (really just an easier replacement for fscommand). All of this is pretty rough – vomit draft material.
– Some smaller code comment and formatting cleanups.
– removed problematic _createAnchor functionality. (Issue 6)
– updated IE version detect to be compatible with multi-digit versions.
– Reworked Error messages so that they make sense in FireBug and other Javascript consoles. Fixes Issue #3
– Added direct and gpu WMode values.
– Made value checking case insensitive.
– Added SVN keywords Revision and Date, and added text/javascript mime-type.
– Fixed SwfShim.

Enjoy! 🙂

]]>
http://www.unfocus.com/2009/07/10/unfocus-history-keeper-2-0-and-swfhtml-beta-4-%e2%80%93-out-now/feed/ 2
unFocus.FlashPlayerInfo update for Player 10 http://www.unfocus.com/2009/05/29/unfocusflashplayerinfo-update-for-player-10/ http://www.unfocus.com/2009/05/29/unfocusflashplayerinfo-update-for-player-10/#respond Fri, 29 May 2009 06:37:50 +0000 http://www.unfocus.com/?p=186 Continue reading "unFocus.FlashPlayerInfo update for Player 10"]]> Adobe has updated their versioning system for Flash Player. This welcome change, creates a few backward compatibility problems with FlashPlayerInfo though, since the terms I applied to each version decimal place, do not match Adobe’s new terms (they are off by one place-ish, sorta).

To address these changes I added a new set of methods to check for the new “major”, “minor” and “bugfix” version numbers, for Flash Player 10+. The old methods will return the same data it does now (Version.MajorRevision.MinorRevision.BetaVersion). The new methods will not work for older Player versions of Flash Player (or at least won’t make sense), returning the data from the new format instead (MajorVersion.MinorVersion.BugfixVersion.build). In older players, getBugfixVersion would refer to “r” or third decimal place version number, which is what you used to look for when trying to detect something like r115. For older players you should continue to use the older getMinorRevision method. There should be no need to update your current detection routines, unless you need to target this new information. One change worth noting, will hopefully not be noticed – getVersion now returns both of MajorVersion and MinorVersion as a JavaScript Number, so that you can check against dot releases (getVersion() > 10.1). This should not affect backward compatibility.

In addition, for Flash Player 9, Adobe released 3 feature or compatibility breaking security updates with strange version names (update 3 was r115 for example, and was significant, adding H.264 and AAC support to the player). So for the special case of Player 9, I added getUpdateVersion. Since Player 9 was the only version to get the odd update versions, this really only applies to that version.

These changes also means that some of the old properties are probably useless in Player version 10+, such as the beta flags and beta version numbers, and getReleaseCode in IE. I used to infer that information from the 4th decimal place, which used to always be 0 except in beta and pre-release builds (based on my observation). In the new version number convention that 4th place is just a build number.

Here are the new methods:
[cc lang=’javascript’ ]unFocus.FlashPlayerInfo.getMajorVersion();
unFocus.FlashPlayerInfo.getMinorVersion();
unFocus.FlashPlayerInfo.getBugfixVersion();
unFocus.FlashPlayerInfo.getBuildNumber();[/cc]

The updated script is in SVN, and will be in the next release.

SwfHTML will probably get a similar update as well.

]]>
http://www.unfocus.com/2009/05/29/unfocusflashplayerinfo-update-for-player-10/feed/ 0
AS3 unFocus.HistoryKeeper in SVN trunk http://www.unfocus.com/2009/04/29/as3-unfocushistorykeeper-in-svn-trunk/ http://www.unfocus.com/2009/04/29/as3-unfocushistorykeeper-in-svn-trunk/#respond Wed, 29 Apr 2009 22:42:03 +0000 http://www.unfocus.com/?p=173 Continue reading "AS3 unFocus.HistoryKeeper in SVN trunk"]]> I added an initial round of AS3 files to the SVN trunk to make HistoryKeeper more accessible from Actionscript 3.0. If you are feeling adventurous, feel free to check it out of the trunk, and give it a try.

There is also a small resurrected Actionscript to Javascript communicator (eh, it’s totally new actually, but I got to use old knowledge!). The theory is that if you use fscommand to send simple strings to Javascript, you save on Flash setting up a lock to wait for a Javascript call to return a value or finish executing, which should conceivably avoid a short hiccup in the Flash Player. I’m not sure if there’s a real world benefit or not yet – one day I might get around to testing to make sure. At the very least, this framework will make it easier to setup fscommand, since it takes care of creating the javascript snippet for you. After that, it will simply eval whatever you put in the command argument (unless it’s a simple function on window, then it’ll just execute that).

Any comments are welcome. Please note, these classes may change quite a bit, they’re not to be considered stable (though the API probably is, there’s not much there really).

]]>
http://www.unfocus.com/2009/04/29/as3-unfocushistorykeeper-in-svn-trunk/feed/ 0
MouseWheel on Mac http://www.unfocus.com/2009/04/17/mousewheel-on-mac/ http://www.unfocus.com/2009/04/17/mousewheel-on-mac/#comments Fri, 17 Apr 2009 23:45:10 +0000 http://www.unfocus.com/?p=140 Continue reading "MouseWheel on Mac"]]> So for some reason MouseWheel.SCROLL events don’t work on Mac OS X. There is a fix! Gabriel over at Pixel Breaker created a script which fixes it up nicely.

The script did require some modification to get it to work with SwfHTML, since it was designed to work with SwfObject. It took very little modification to the JavaScript to make it work with any flash embedding script. The script has a register method that takes an id, and uses SwfObject’s getObjectById method to get the swf ref – I just changed the register method to take a swf reference instead of an id string, and viola! It works with anything now. While I was at it, I also took care of some errors you might get on non-mac browsers. Here’s how to use it:

[cc lang=’javascript’ ]
// with SwfHTML
swfmacmousewheel.registerObject(
unFocus.SwfUtilities.getSwfReference(“swfId”)
);

// with SwfObject
swfmacmousewheel.registerObject(
SwfObject.getObjectById(“swfId”)
);
[/cc]

You can really use any method you want to get a reference to the swf object, and pass that in.

Here is the updated swfmacmousewheel javascript file. Note, you will still need to grab the source and follow the instructions from Pixel Breaker.

]]>
http://www.unfocus.com/2009/04/17/mousewheel-on-mac/feed/ 1
Quick Update – HistoryKeeper, SwfHTML, SwfShim http://www.unfocus.com/2009/01/15/quick-update-historykeeper-swfhtml-swfshim/ http://www.unfocus.com/2009/01/15/quick-update-historykeeper-swfhtml-swfshim/#respond Thu, 15 Jan 2009 06:21:15 +0000 http://www.unfocus.com/?p=54 Continue reading "Quick Update – HistoryKeeper, SwfHTML, SwfShim"]]> Just a quick post.

There have been a couple of fixes and changes that have gone into HistoryKeeper, SwfHTML and SwfShim that are now in the SVN trunk, as well as a few other issues that have been nailed down, and put into the issue tracker.

Among the fixes are finally a fix for the incorrect use of Javascript Errors in SwfHTML, as well as fixing the previously unfinished SwfShim.

Despite the fact that I can’t figure out how to pass flashvars from SwfShim to loaded AS3 based swfs, I’m still going to include it anyway, with a note about that caveat. It does solve some other issues, and adds an easy way to utilize ExpressInstall even if you are using html to embed the swf (rather than javascript). More on that in a future post.

I’ll also be cleaning house around the site, here and on google code. I’ve already removed some old lingering (and useless) ad stuff.

Also, since Microsoft removed the “click to activate” silliness, I went ahead and deprecated PatentMagic. It was buggy anyway.

Check back for more updates, and hopefully, an actual release!

]]>
http://www.unfocus.com/2009/01/15/quick-update-historykeeper-swfhtml-swfshim/feed/ 0
A problem with Flash Player 10 version number and javascript detection http://www.unfocus.com/2008/05/16/a-problem-with-flash-player-10-version-number-and-javascript-detection/ http://www.unfocus.com/2008/05/16/a-problem-with-flash-player-10-version-number-and-javascript-detection/#comments Fri, 16 May 2008 20:30:39 +0000 http://www.unfocus.com/?p=41 Continue reading "A problem with Flash Player 10 version number and javascript detection"]]> As you may have heard, Adobe recently released the first beta of Flash Player 10. It looks like unFocus.FlashPlayerInfo has been checking for single version digits, rather than multiple:
[cc lang=’javascript’ ]
_versionRaw.match(/Shockwave Flash (\d)\.(\d)/);
[/cc]
The fix is easy enough (I could swear I actually fixed this at one point too):
[cc lang=’javascript’ ]
_versionRaw.match(/Shockwave Flash (\d+)\.(\d+)/);
[/cc]
This problem doesn’t seem to be limited to just the unFocus Flash Detection script. I’ve seen other claims of failed Flash detection in other corners as well. I’d bet most of the problems are with the plugin detection scripts (Mozilla Firefox, Opera, Safari, etc.) and not with the ActiveX detection scripts (Internet Explorer), since most of the plugin detection scripts out there are using string parsing techniques, and have probably not tested with multiple digit Flash versions (since there haven’t been any until now).

I’ll see about getting a release out soon. If anyone needs any help updating anything, feel free to leave a comment, or email me.

]]>
http://www.unfocus.com/2008/05/16/a-problem-with-flash-player-10-version-number-and-javascript-detection/feed/ 4
unFocus.History Keeper 2.0 (and SwfHTML) Beta 2 – Out Now! http://www.unfocus.com/2007/09/12/unfocushistory-keeper-20-and-swfhtml-beta-2-out-now/ http://www.unfocus.com/2007/09/12/unfocushistory-keeper-20-and-swfhtml-beta-2-out-now/#comments Wed, 12 Sep 2007 06:22:05 +0000 http://www.unfocus.com/projects/2007/09/12/unfocushistory-keeper-20-and-swfhtml-beta-2-out-now/ Continue reading "unFocus.History Keeper 2.0 (and SwfHTML) Beta 2 – Out Now!"]]> unFocus.History Keeper 2.0 Beta 2 is now available for download.

Feel free to download, test and use the new beta. Here’s what’s new and fixed:

  • History.js – There was an odd error, from a mixed up function, keeping History Keeper from working at all in the last release. It was the first issue reported by someone other than myself (thanks shacky7!) and it’s been fixed.
  • FlashPlayerInfo.js – was throwing an error if there was no flash player installed at all in IE. It’s fixed.
  • FlashPlayerInfo.js – added more robust Flash Player 6 detection. It is impossible to check for some minor revision versions in Flash Player 6, because they crash IE if you do. It’s now possible, though, to check for 6.0r65, which is the first version to support Express Install.
  • FlashPlayerInfo.js – deprecated “.getPluginType()”, and replaced it with “.getPlayerType()” and made it actually work. To practice discipline, I left “.getPluginType()” since it’s improper to change the API after a beta release (it didn’t work before, so I’m sure no one is using it).
  • FlashPlayerInfo.js – Fixed beta and MinorRevision errors in ActiveX path.
  • SwfHTML.js – was producing a security warning in IE if used over https. It’s fixed.
  • Added a bunch of test files for each object, to help make sure stuff doesn’t break (that’s annoying), and more thoroughly test the various methods and features. It is almost, sorta like unit testing, if you kinda look at it sideways, in a mirror. 🙂
  • Added Object Patent Magic to the package.
  • Added SwfShim to the source (under javascript folder), but it’s not ready for prime time yet, and is not in the packed js file.
  • Added some example pages – but these are really just there to test to the packed files, at the moment. HistoryKeeper.html is a good place to start if you want to learn how to use History Keeper. I’ll update soon with some Flash examples.

Check out the updated project page for more info, or just skip straight to the download. 🙂

]]>
http://www.unfocus.com/2007/09/12/unfocushistory-keeper-20-and-swfhtml-beta-2-out-now/feed/ 4