haxe/nme loading screen - haxe

How can I specify what should be displayed while my app loads? I was expecting something similar to Flex, where you can set a custom sprite with the preloader property of the Application class. Then this sprite is displayed while preloading, an that sprite is loaded before everything else. I was expecting some tag for this in the nmml file, but looking here:
http://www.haxenme.org/developers/documentation/nmml-project-files/
I can't find anything...
Thanks in advance!

Just to provide an answer in case someone has the same question. It is done in the nmml file in the app tag, like so:
<app ... preloader="com.myapp.MyPreloader" />
Then the preloader class should extend NMEPreloader which has a number of functions you can override, most noticeably an onUpdate method.

Related

How to append an html element when using flatpickr

I'm having the weirdest problem and I'm stumped.
I'm using flatpickr as a date picker on my site, and this tool works really well, however I'm thinking I would like to add an additional image on the popup dialog. I'm thinking 'I can do this!' and so off I go.
I found the onOpen() hook and knew it was the perfect function for what I needed to do. Then I wrote some jQuery to reference the correct area on the dialog and then .append(htmlString)
My code for generating the popup and my configuration options are:
$dateRangeInputs.flatpickr({
altInput: true,
mode: 'range',
onOpen: function(selectedDates, dateStr, instance) {
instance.prevMonthNav.append("<img src='/ui/images/icons/arrow-left.svg'>");
}
});
The problem is the 'htmlString' is treated entirely as text, ignoring the html instructions, so I get the following HTML turning up in the dialog.
<svg version="1.1" ...> ... </svg>
<img src='/ui/images/icons/arrow-left.svg'></span>
I've included a picture also, for those of you who prefer visual explanations.
I have checked and rechecked the jQuery append() command, it should be processing the htmlString argument correctly. My only thought is that there is something in the flatpickr library that is only allowing text to be included. I think my best help will come from others who are using flatpickr.
Worked it out!
I needed to wrap the instance property as a jQuery selector, like this:
onOpen: function(selectedDates, dateStr, instance) {
$(instance.prevMonthNav).append("<img src='/ui/images/icons/arrow-left.svg'>");
}

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?

In Scenekit, why is there a distortion in 3d object when rendered?

In Xcode, this is how an object created in Blender and exported in DAE file looks:
Then, when I click the little play button below the image, or when I run the app and render it, it looks like this:
What can be causing this, and how can I avoid it?
This was produced by parenting. The torus had a parent, removing the parent avoided the distortion.

VivaGraphJS: Is there a way to start the display of the nodes from top,left of the container?

I am trying to implement vivagraph. However it always shows the entire graph at the somewhere below right corner. From firebug it looks like the g tag is getting a lot of matrix transformation.
The problem is that I have dynamically increasing/decreasing nodes per view of the page, so I cant override it with 1 single translate. So is there a way to have it done?
Answered here: https://github.com/anvaka/VivaGraphJS/issues/131
The issue was caused by missing CSS selector

Create a map with clickable provinces/states using SVG, HTML/CSS, ImageMap

I am trying to create an interactive map where users can click on different provinces in the map to get info specific to that province.
Example:
archived: http://www.todospelaeducacao.org.br/
archived: http://code.google.com/p/svg2imap/
So far I've only found solutions that have limited functionality. I've only really searched for this using an SVG file, but I would be open to other file types if it is possible.
If anyone knows of a fully functioning way to do this (jQuery plug-in, PHP script, vector images) or a tutorial on how to do it manually please do share.
jQuery plugin for decorating image maps (highlights, select areas, tooltips):
http://www.outsharked.com/imagemapster/
Disclosure: I wrote it.
Sounds like you want a simple imagemap, I'd recommend to not make it more complex than it needs to be. Here's an article on how to improve imagemaps with svg. It's very easy to do clickable regions in svg itself, just add some <a> elements around the shapes you want to have clickable.
A couple of options if you need something more advanced:
http://jqvmap.com/
http://jvectormap.com/
http://polymaps.org/
I think it's better to divide my answer to 2 parts:
A-Create everything from scratch (using SVG, JavaScript, and HTML5):
Create a new HTML5 page
Create a new SVG file, each clickable area (province) should be a separate SVG Polygon in your SVG file,
(I'm using Adobe Illustrator for creating SVG files but you can find many alternative software products too, for example Inkscape)
Add mouseover and click events to your polygons one by one
<polygon points="200,10 250,190 160,210" style="fill:lime;stroke:purple;stroke-width:1"
onmouseover="mouseOverHandler(evt)"
onclick="clickHandler(evt)" />
Add a handler for each event in your JavaScript code and add your desired code to the handler
function mouseOverHandler(evt) {};
function clickHandler(evt) {};
Add the SVG file to your HTML page (I prefer inline SVG but you can use linked SVG file too)
Upload the files to your server
B-Use a software like FLDraw Interactive Image Creator (only if you have a map image and want to make it interactive):
Create an empty project and choose your map image as your base image when creating the new project
Add a Polygon element (from the Shape menu) for each province
For each polygon double click it to open the Properties window where you can choose an event type for mouse-over and click,
also change the shape opacity to 0 to make it invisible
Save your project and Publish it to HTML5, FLDraw will create a new folder that contains all of the required files for your project that you can upload to your server.
Option (A) is very good if you are programmer or you have someone to create the required code and SVG file for you,
Option (B) is good if you don't want to hire someone or spend your own time for creating everything from scratch
You have some other options too, for example using HTML5 Canvas instead of SVG, but it's not very easy to create a Zoomable map using HTML5 Canvas,
maybe there are some other ways too that I'm not aware of.
Just in case anyone will search for it - I used it on several sites, always the customization and RD possibilities were a perfect fit for what I needed. Simple and it is free to use:
Clickable CSS Maps
One note for more scripts on a site: I had some annoying problems with getting to work a map (that worked as a graphic menu) in Drupal 7. There where many other script used, and after handling them, I got stuck with the map - it still didn't work, although the jquery.cssmap.js, CSS (both local) and the script in the where in the right place. Firebug showed me an error and I suddenly eureka - a simple oversight, I left the script code as it was in the example and there was a conflict. Just change the front function "$" to "jQuery" (or other handler) and it works perfect. :]
Here's what I ment (of course you can put it before instead of the ):
<script type="text/javascript">
jQuery(function($){
$('#map-country').cssMap({'size' : 810});
});
</script>
Go to SVG to Script
with your SVG the default output is the map in SVG
Code which adds events is also added but is easily identified and can be altered as required.
I have been using makeaclickablemap for my province maps for some time now and it turned out to be a really good fit.
I had the same requirements and finally this Map converter worked for me. It is the best plugin for any map generation.
Here is another image map plugin I wrote to enhance image maps: https://github.com/gestixi/pictarea
It makes it easy to highlight all the area and let you specify different styles depending on the state of the zone: normal, hover, active, disable.
You can also specify how many zones can be selected at the same time.
The following code may help you:
$("#svgEuropa [id='stallwanger.it.dev_shape_DEU']").on("click",function(){
alert($(this).attr("id"));
});
Source
You have quite a few options for this:
1 - If you can find an SVG file for the map you want, you can use something like RaphaelJS or SnapSVG to add click listeners for your states/regions, this solution is the most customizable...
2 - You can use dedicated tools such as clickablemapbuilder (free) or makeaclickablemap (i think free also).
[disclaimer] Im the author of clickablemapbuilder.com :)
<script type="text/javascript">
jQuery(function($){
$('#map-country').cssMap({'size' : 810});
});
</script>
strong text

Resources