How to create html with openfl? - haxe

I want to be able to fully adjust the width and height of the playing area. That is, I do not want to call the openfl test html5, but I want to create my own html and add openfl to it. (Like working on canvas)? How can i do it

You can specify a custom index.html template in application.xml, like so:
<template path="assets/index.html" rename="index.html" />
(also see documentation)
Other option would be to embed the OpenFL application in an <iframe>.

Related

Is there a way to have the user upload an SVG file but then render the SVG source?

Using 2sxc on DNN, I have a website that uses SVGs for icons in content types. The client wants to be able to upload the SVG icons to 2sxc via a Link field but then instead of rendering <img src="#Content.SVG" />, they want it to render the source code of the SVG (so we could manipulate the fill color via CSS). Is this even possible and how could it be done?
Basically 2 steps
Get the real file name using 2sxc and DNN
Then load the file as a string using normal .net stuff System.IO and add it to your html - https://learn.microsoft.com/en-us/dotnet/api/system.io.file.readalltext?view=netframework-4.5.1
ca. like this
<div>
#Html.Raw(System.IO.File.ReadAllText(fileName)
</div>
Some examples of how to do this can be found below
Using the fetch API
How to convert image (svg) to rendered svg in javascript?
Older methods such as XMLHttpRequest or jQuery
Include SVG files with HTML, and still be able to apply styles to them?
Using D3
(Embed and) Refer to an external SVG via D3 and/or javascript
Using a custom JS library
One example: SVGInjector
Interestingly Dnn is doing this nowadays and you can look at the code here. If you ignore the caching, you might be able to do similar in a View.
https://github.com/dnnsoftware/Dnn.Platform/blob/0d3b931d8483b01aaad0291a5fde2cbc0bac60ca/DNN%20Platform/Website/admin/Skins/Logo.ascx.cs#L123
And that is called from above, see ~line 71, so they are doing a real inject of the file contents to inline. Obviously caching file-access stuff should be a priority for caching if the website is high-traffic, but otherwise it is not needed or at least secondary.

How to add "video element" in the template html in Weebly

I am out after adding a video element in the template level as it is possible to add a button element like the following;
{action:button}
Is there any way of doing it like this;
{media:video}
I am building a custom template, that's why I should statically give such elements in the HTML so that user can see that there is a video element in the content (it is mandatory) and s/he will edit the source of with the desired URL.
Unfortunately video is not a valid tag.
See:: https://dev.weebly.com/create-the-html-layout-templates.html
The only real option would be to use Weebly's built-in Sections feature, which allows the user to add a video as a background (if that was your intention).
The only other options would be to have them hardcode the URL of the video, in your Theme, have them use the Video Element or point them in the direction of the App Center so they can use an app that provides the feature.

AEM 6.2 (Drag Component Here) Parsys height 0px

I am using AEM 6.2 and trying to create a parsys component in crx, using the code below
However, the height of this parsys, in edit mode, comes as 0px.
Attached are the screenshots.
When I manually change the height to some values eg. 40px, it looks fine.
Note: I am not using any client library for the above page. (no css and js)
Futher, All sample sites like geomatrix etc have parsys showing correctly.
Could anyone guide me with what I am doing wrong?
I think that the problem is outside the component or any of the code shown here.
I think what's happening is that the css style for the div that gives the droptarget placeholder its dimensions is not loading.
That's loaded as part of the AEM authoring client libraries which you should be inheriting from the foundation page component.
Examine your page component's sling:resourceSuperType property. It should point to either wcm/foundation/components/page or wcm/foundation/components/page or inherit from a component that does.
If that is set then you have may have blocked one of the scripts within it, quite possibly head.html.
Include following code in the head section of the page component's rendering script.
<!--/* Include Adobe Dynamic Tag Management libraries for the header
<sly data-sly-include="/libs/cq/cloudserviceconfigs/components/servicelibs/servicelibs.jsp" data-sly-unwrap/>
*/-->
<!--/* Initializes the Experience Manager authoring UI */-->
<sly data-sly-include="/libs/wcm/core/components/init/init.jsp" data-sly-unwrap/>
For resolving your issue, you need to include init.jsp in the first before writing down the parsys code. I mean write like this.
<head>
<sly data-sly-include='/libs/wcm/core/components/init/init.jsp' />
</head>
<body>
<sly data-sly-resource="${'par' #resourceType='foundation/components/parsys'}" />
</body>
I think #l-klement pointed it out correctly that the problem is outside component. When I rename the landingpage.html file to body.html it starts working fine. I think this may be because of different files like head.html etc present at wcm/foundation/components/page which is required to provide proper styling and load certain required client libraries which assigns proper styling to parsys.
If the above is true, my next question would be, How can I have my own head.html, body.html, header.html, footer.html etc files without compromising with the parsys styling?

how to get rid of MS Azure Media Services logo overlay (water mark)

How do you get rid of or replace the Microsoft Azure Media Services logo overlay (water mark) that is put onto dynamic packaged video? The following link shows the topic area:
https://azure.microsoft.com/en-us/documentation/articles/media-services-dynamic-packaging-overview/
My html contains embedded code taken from http://amsplayer.azurewebsites.net/azuremediaplayer.html
It seems that you are attempting to use the iframe embed code on the "get embed code" section of the player. Please note that this is currently under development, as it is listed on the site: "this embed code is for demo purposes only. Do not use in production."
For your player needs in production, especially if you want to use the large amounts of API's available, you should create your own player page following the instructions in the documentation and by using the samples provided.
Specifically for the question regarding the logo, there is an API available to remove to logo and can be found in the logo option section of the documentation. This is the correct way to remove to logo using the APIs provided.
It might be helpful to post some of the HTML that you are using when you say "My html contains embedded code taken from..."
It looks like the code on that page has the following div:
<div class="amp-logo" style="opacity: 0.5;"></div>
This appears to be what is placing the logo on the page you reference. Not know what HTML is actually in your page, I don't know if this is the HTML they are generating for you as embedded or whether you cut and paste the HTML from the given page.
You may be able to remove it from your HTML. If not, try creating a style that overrides the amp-logo class.

Using Orchard CMS, how do I add a script reference for display only on the home page?

I have a site that is using Orchard CMS and I would like to add a script reference and bit of JavaScript to the home page. It needs to be placed below the existing jQuery script include. What's the best way to achieve this? I've tried using an HTML Widget in the Footer zone of TheHomePage layer of my theme, but this widget produces a and doesn't place the element in the correct location (at the bottom of the element, below the existing jquery reference).
The site is running an old version of Orchard; 1.0 I believe.
You can either use a layout alternate for the homepage (but that may not exist on an antique 1.0), layout-homepage.cshtml with a #using(Script.Foot()) {} block containing your script, or you can use Vandelay Classy to add a script from the admin (but that probably also won't work on 1.0).
Or if none of what Bertrand mentioned above work, just add a html widget to the homepage layer and chuck your script reference in the html section

Resources