One file from $hypeRessources not found


(Salvador) #1

Hi,
Hype is the best App i’ve used for creating WebApp !

I’ve just run in trouble once: i did a wonderfull navigation App threw my SVG Map.
All worked fine at home for previewing.

I uploaded my Scene to my server, and i’m getting this message in the console:

“NetworkError: 404 Not Found - http://www.mySite.fr/myDiretory/consult/crealConsult.hyperesources/myFile.svg

I refered to my svg in a box with “embed [src=”${resourcesFolderName}/myFile.svg" id=“mySvg”]"

I uploaded it threw ssh.

I was root (?). Never had problem, for i do a chown www-data

The only thing i really see is that i had to refer to the app in my php y this reference:
[script type=“text/javascript” charset=“utf-8” src="**http://www.mySite.fr/myConsult/**myConsult.hyperesources/myconsult_hype_generated_script.js?50399"]

If i replace my ${resourcesFolderName}/mySvg with the URL, nothing works anymore.

What should i do, please ?

However, Thank you for the great job


(Salvador) #2

I solved my problem:
1/ I did not try to modify Ressources: it seems it’s complicated. And URL rewriting on my WebSite kills every tries to enhance my folder trees.
2/ I embeded the SVG using its distant URL.
3/ The problem is that javaScript Ressources made inside Hype do not apply to embedded SVG file: i mean - if i define a function ( zoom() ) in my hypeScene, i can’t use it on the embededSvgFile. So i had to define new functions for every buttons i had drawn.

And it works again.
Coole Stuff !
Here is a Screen Shot of my web Editor for http://www.crealscience.fr


#3

Do you think you could post an example of this issue you’re seeing? I’m not understanding…


(Salvador) #4

Thank you for your quick answer.

I can’t post anymore, but it’s quite simple:

I have a box on my scene, id « view ».

When i work at home, i put my svg file in my Ressources and wrote my code:

  • in the view Box: <embed src="${resourcesFolderName}/navigfab.svg" id="mySvg »>

  • svg.js with a init() and zoom() functions.

In my Preview, all is ok: i zoom, move and translate with buttons calling hype javascript « init(); zoom(1.2); »

After upload, nothing works: ${resourcesFolderName} has disappeared.

So i turned back home.

I changed my embed to <embed src=http://www.crealscience.fr/images/navigfab.svg" id="mySvg »>

Picture appears; script don’t work anymore::::: « zoom() is not a function » and same answer for « init() » ….

I took back my scripts from svg.js and put the code inside Hype JavaScript Editor.

Instead of calling Zoom() function, i created a Zoom() action in Hype editor with the code:

    s = 'h';

    d = 1;

    var embed = document.getElementById("mySvg");

    var tabsvg = embed.getSVGDocument();

    //tabsvg = document.getElementsByTagName("svg");

    // récupération taille image

    translate = tabsvg.getElementsByTagName("g")[0].getAttribute("transform");

    /translate\([-0-9.]+ ([-0-9.]+)\)/.test(translate);

    SVG = tabsvg.getElementById("cont");

    coord = SVG.getAttribute("viewBox").split(" ");

            if (s == "h") {

            coord[0] = String(parseFloat(coord[0]) + d*100);

    } else {

            coord[1] = String(parseFloat(coord[1]) + d*100);

    }

    nc = coord.join(" ");

    SVG.setAttribute("viewBox",nc);

And all is working fine again.

So i guess that « embed » is similar to an iframe, or something like that. my SVG.js was no more « recognised ».

Tank you for your great work