Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by faceyspacey

I got it working for Construct 2. You can see in action in ie7 and ie8 here: http://linkit.faceyspacey.com.

I'd like to do the same for ImpactJS. I've had a hard time doing it though. Anyone want to help me with this? Anyone tried?

1 decade ago by Joncom

So this converts HTML5 to Flash... Isn't that a step in the wrong direction? :P

1 decade ago by faceyspacey

why does everyone in these forums think that? no, not when you're building education apps and large percentages of computers still use IE8 and below.

even on regular sites, IE8 and below makes up like 11% of your traffic. That's a serious number. In US public schools, it's about 50% of computers! In many markets, the same is true.

if you can get the support, why not?

1 decade ago by Datamosh

I agree on the need for this.
Everyone loves compatibility.
For Facebook games is really a must.

With your tips in another post I have no errors on Impact under IE8, but FlashCanvas not display an image.
Is there any way to reset the canvas with impact after a few seconds to load FlashCanvas?

1 decade ago by faceyspacey

@datamosh, can you host what you did so I can look at it? or email me the code: james@faceyspacey.com

what do you mean by "reset the canvas with impact" ???

did you check my link to the scirra.com post? flashcanvas should load after all the impact code. I think that's what you're trying to do. Try to put the code like this:

<body onload="setup()">

and in Setup() get flashcanvas going. I do this on http://linkit.faceyspacey.com

1 decade ago by obj63

Hi All,

I am having the same issues first though in IE8 is I keep getting an error -

SCRIPT5009: 'HTMLElement' is undefined
impact.js, line 104 character 3

Does anyone know how to work around that. I think if I can get that taken care of I will be able to get the rest to load possibly.

1 decade ago by obj63

Okay so I simply removed the or option and I didn't see anything break in my game in other browsers so I am guessing it is not 100% needed. I stripped all of the Audio engine and turned off/commented out anything with sound but still can't get flash canvas to work.

I do see that the object is inserted into the dom and I am loading all impact code and my game code after the window.onload function so not sure what else to look for doesn't look like it will work. Any recommendations on this? Would really, really like to get some sort of polyfill working for older browsers.

1 decade ago by obj63

With a lot more testing I can say that I can get flashcanvas to work with everything except for the following -

1. Do not prerender backgrounds as this tries to create a new canvas context and then fails.
2. Same thing with fonts - don't use those
3. Strip out anything that relates to sound.js

After that everything is now finally loading fine I just can't get user input to work.

The error I was getting is addEventListener is undefined so I changed all of those to the IE standard attachEvent... Game loads and runs fine but user input is not working.

If anyone can help me with this last step I will be truly grateful.
Thanks
Joe

1 decade ago by Datamosh

WOW! Great update!
@obj63 upload demo here or private forum plz!
I will create a repository on GitHub with a demo (jump & run) so all together solve the problems.

1 decade ago by obj63

Hi All,

I was able to get this working but I had to have two separate code bases for the impact library code base. One that will let me run in IE8 and IE7 with flash canvas pro and one for everything else.

To continue my earlier list -
1. Don't pre render backgrounds - this creates a separate canvas in the backend and swaps it in and since we can't have more than one canvas it won't work.

2. You won't be able to use fonts, works similar to pre rendering of backgrounds - you can use text that is z-indexed above the game though to display things like a HUD and score, etc.

3. Remove anything that relates to sound.js so you won't be able to use Sound, SoundManager or Music. This will require editing a few files but is pretty easy to handle. If you want to use sound effects though you can use something like http://jplayer.org/ where you instantiate a jplayer object in the background of the page and then simply have it play the sound file needed at your given event. Pretty easy to setup with a pub sub relationship. jPlayer uses flash as its fall back to play mp3 files so will work in all browsers!

4. input.js - I used jquery in combination with impact to handle all the input binding statements so instead of say -
window.addEventListener... I am using a jquery equivelant bind function.

So with changing all of that in input.js so example -
window.addEventListener('keydown', this.keydown.bind(this), false );
becomes
$(document).bind('keydown', this.keydown.bind(this));

and updating all the specific references in input.js I was able to get everything working. The reason I did this with jquery is jquery will still let you bind to events that the dom may not actually know exists such as events the canvas itself may throw as ie7 and 8 have no idea what the canvas even is. Also jquery will let you run preventDefault and stop propogation on its own events where as IE7 and IE8 have no concept of this.

Some notes though ie7 and 8 do not support binding to keydown or keyup on the window, this must be done on the document level. more info here http://quirksmode.org/dom/events/keys.html
All of the other events were able to be bound with the variable used in the original statements though so just have to watch out for that key up and key down.

5. in the impact library look for if statements that contain the word HTMLElement I believe all of these are just in impact.js file and simply remove that part of the if statement as it is part of an Or clause and all will work fine and won't error in IE7 and IE8.

With the changes above and using Flash Canvas pro you will be able to make your game work in IE7 and IE8. There was a stray comma too in one of the impact library files but when removed it all worked in IE7 then too just use the ie9 dev tools in ie7 mode and you can see where it errors out at. Our game is still in qa now but once ready I'll post some links so you all can see for yourself.


@Datamosh - I would put these changes in github but they are core changes to the impact library so I don't want to publish all their code. If you follow these steps though and the suggestions from setting everything to be loaded after window.load all should work fine. You can use jquery.getScript to load the impact library and then your game after flash canvas is initialized and all will run then.

Hope this can help anyone that has to have impact run in IE7 and IE8 you will have to make some compromizes though and deal with multiple code basis but it is doable.

1 decade ago by obj63

Last thing in impact.js file you will also need to remove the OR clause in if Statements that contain the variable HTMLElement. IE7 and IE8 don't know what HTMLElement is so it throws a JS error. Simply removing that part of the if statement resolved the error and I didn't see any issues in doing so.

Cheers!

1 decade ago by obj63

Hi All,

If you need to see an update on this actually running checkout - http://t.co/ZfojCVm8
Page 1 of 1
« first « previous next › last »