• Content Count

  • Joined

  • Last visited

About trial

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thank you so much. You've been a very big help! I've managed to get audio to pause when viewed on Safari browser. It's working very well, but another obstacle cropped up. When saved as a standalone web app on the home screen for ios, the sound still plays, even after the screen is locked. I found a way to detect if the page is opened as a standalone home screen app, but I can't seem to find any codes that will detect if the screen is locked. document.hidden doesn't seem to work. Does anyone know a way to detect when screen is locked?
  2. With your tips, I managed to get it to work well by doing: - using ogg with m4a as alternative format. - followed preloadjs tutorial I found on the web. - added "touch to start" button for mobile. But now, the sound still plays even after I close the web browser or lock phone. I notice your car racing game pauses even after closing the phone browser. What codes do I need to do this to pause all sounds/animations?
  3. Hi, I manage to figure out how to tween a button's alpha from 1 to 0.5, using tweenjs. Now I can't seem to get it to jump to a certain location after the alpha is 0.5: this.coverBtn.addEventListener("click", coverBtnfadeOutClick.bind(this)); function coverBtnfadeOutClick() { createjs.Tween.get(this.coverBtn) .to({ alpha: 0.5 }, 100, createjs.Ease.none); if (this.coverBtn.alpha == 0.5) { this.coverBtn.x += 100; } } I usually just use onEnterFrame for AS2 in Flash era. How do I do that for html5?
  4. in Animate CC, how do I make a global fadeOut function? In my canvas I have a Square and a Circle movieclip acting as buttons. I want to be able to click on each and have them fadeOut. Instead of writing the fadeOut code individually, is it possible to just usea global function? I don't really know what I'm doing. Found Adobe's page about Convert your ActionScript code to HTML5. I tried my hand at it, but I'm stuck at this: //Square btn this.square_mc.addEventListener("click", square_mcClick.bind(this)); function square_mcClick() { fadeOut(); } // Circle btn this.circle_mc.addEventListener("click", circle_mcClick.bind(this)); function circle_mcClick() { fadeOut(); } // Global fadeOut function function fadeOut() { this.addEventListener('tick', fl_FadeSymbolOut.bind(this)); this.alpha = 1; function fl_FadeSymbolOut() { this.alpha -= 0.01; if (this.alpha <= 1) { this.removeEventListener('tick', fl_FadeSymbolOut.bind(this)); } }
  5. trial

    (Solved) Need help translating AS2 code to HTML5

    Thank you, this worked perfectly!
  6. I was using locathost. I tried putting it up on github, used m4a & ogg sounds. Now all desktop browsers are playing it seamlessly! iOS sometimes seamless, sometimes not. I notice your stockcarhero game's menu theme loops seamlessly in mobile. What's the code you use for it to get it that way?
  7. I tried ogg and m4a. ogg seems to work best in firefox, with barely any gaps. but when i use m4a, there's still gaps in safari. chrome seems to still have gaps no matter which format i use. The only way is to not use music that loops, or no music at all?
  8. Hello, I'm trying to translate this gotoAndPlay/array framelabel code from as2 into html5, but I'm not having much luck: frameLabel = new Array() frameLabel[0] = "repeat"; frameLabel[1] = "dontrepeat"; rand = random(frameLabel.length); gotoAndPlay(frameLabel[rand]); I got this html5 random array code from somewhere but couldn't make it work: var frameLabel = ["repeat", "dontrepeat"]; var rand = frameLabel[(Math.random() * frameLabel.length) | 0]; this.gotoAndPlay(frameLabel[rand]); Anyone can help?
  9. Hi, after browsing the web for hours, I managed to find a code that sort of works: createjs.Sound.on("fileload", handleLoad); createjs.Sound.registerSound("", "bgmLoop"); function handleLoad(event) { var bgmLoopInstance ="bgmLoop", { interrupt: createjs.Sound.INTERRUPT_ANY, loop: -1 }); } The problems are: 1. The music doesn't loop seamlessly, there's a gap before it starts back again. 2. The music doesn't start in desktop Firefox and Chrome. Anyone have any ideas how to fix? I heard howler.js does loops seamlessly, but I have no idea how to use it together with createjs in Animate CC.