Hi all, i´m making a webside to my game, wanna play the video trailer(from youtube link) in my webside on html5 target, how can i do that?
If it runs in the DOM target, you could use an
<iframe /> element inside of an
Or, you could use
openfl.external.ExternalInterface (or just untyped JS calls) to execute code and create a DOM element to float above your game content
Here’s a simple embed:
Thanks ! i will try, never hear of DOM taget before
ok, i´m really lost;
Do i have to use this:
<iframe width="420" height="315" src="https://www.youtube.com/embed/A5n1nx8Yr7U"></iframe>
inside the DOMSprite params? like this:
var video:DOMSprite = new DOMSprite("Here?");
or it goes inside the project.xml? them i have to cast it?
I think it would be something like this:
import js.html.IFrameElement; import js.Browser; ... var iframe:IFrameElement = cast Browser.document.createElement ("iframe"); iframe.width = 420; iframe.height = 315; iframe.src = "https://www.youtube.com/embed/A5n1nx8Yr7U"; var domSprite = new DOMSprite (iframe); addChild (domSprite);
Thanks Singmajesty! it works perfect!
Hello @singmajesty I am trying this code I’m on openfl version 3.6.1 and lime version 2.9.1 and I can’t seem to get the iframe to work properly any help would be much apperciated thanks
Are you using Flixel, or is there any other reason why you use those versions? Thank you
Yes I’m using haxe flixel but I even tried writing the code in complete openfl as well as adding it to the stage via haxeflixel addChild below mouse
Well, I was curious, because we have over a year of fixes since that version