AS3 physical path problem in linux environment - actionscript-3

Am developing a video player in as3 , everything is fine, but finally i got a prob in basic itself.
Question is How to specify the path to loading xml into flash. FOr example
urlreq.load("hostname/filename");
instead of host name i have to specify my physical path infact i should. so how to specify this.
means i have to load a xml file from root directory, something like
"/opt/adobe/fms/applications/vod/media/moviename/chapters.xml"
here i couldnot get the file.
Please some one help me out.

I'm not sure I understand the question correctly, but as far as I know there is no way to specify an absolute path for the filesystem; When using an absolute path (/...) it is actually relative to the root URL of the web-site where this SWF is being served from (or the folder where it is being run from during debug process).

Related

How can I access root directory in HTML? (Using / is not working)

So I'm trying to access my root directory in HTML but when I use / it is not working. So for example I'm trying to get my navigation css by doing:
<link rel="stylesheet" href="/nav.css">
The weird thing is, it works perfectly fine when I am using VS Code with the live server extension, but I just recently noticed when I run the index.html file alone none of the links starting with the / work. I know this is the issue too, because when I take away the / in the above line, it works perfectly fine again (only for the homepage page in the root directory already).
As Quentin points out, if you're loading the index.html file locally without a server, the root directory will be the root of your file system. If your requirement is for the index.html file to work locally on your professor's machine without a web server, you should use relative paths.
In order to traverse back up your file system from the current file, you can use paths that start with ../
when I run the index.html file alone none of the links starting with the / work
If you are running index.html alone then the links starting with / will be relative to the root of your file system.
The browser doesn't (and can't) know which directory represents the root of your web site project.
Use a web server. Load the data over HTTP.
Try this:
./nav.css
It (I mean, ./) loads files in the same directory of index.html, same as nav.css. With VS Code, I bet ./nav.css should work for the live preview too: using an external HTTP server (such as http-server on Node.js) helps, because it takes the current directory (where index.html is) as the root and you can easily reach /nav.css. Without a live server, the relative path could be reached as I said with ./nav.css (a typical *NIX path) or simply nav.css without slashes on Windows.
As others have indicated then the reason it's not working is because by loading the file directly you are now loading it as a local file rather than a file on website, and thus your URL base (Your /) is now referring to the root of your local file system. Which would likely be C:\ on a windows system or your actual root / on a *nix system.
To actually solve your issue I would suggest one of the following solutions:
Just always run the project over HTTP through a server.
Go through your project and change all of your paths to be relative paths. You might be able to use a find replace in your editor to do this.
Use a <base> tag to specify what the base href of your web page should be.
If you can't use a server and just have a single HTML file then it might be quickest to use fix 3. You can probably get away with using <base href="."> to make the base the current directory of your index.html file which, I suspect, will be a drop in solution to make things work as they did before.
In future best consider this and how you are going to run the file, and what your URLs are going to be relative to. It's a wrinkle that can be easily missed nowadays that the tools we use in development are so good at hiding the details of how websites are actually deployed.
I don't think <base> is a good idea.
It will change the base href in the whole page, which might cause problems when using other links or section navigation.

404 (Not Found) Image file on web app

I am building a website and along the way I used imgur to store the image that i was using in it but I decided to created a folder in my app to store them.
Since I'm not using imgur anymore, i needed to change my path to find the image and that's where the problem appeared, I can't find the image.
The structure looks like that:
webapp_folder
|_node_modules
|_image_folder
|_public_folder
|_views
|_partials_folder
|_main.js
|_app.js
|_package.json
In main.js, I use one of the image in image_folder and the path to the image looks like: src="../image_folder/image.png" but that's where I got the 404 error.
I've tried putting the image in the same folder that the main.js so the path would look like src="image.png" but still getting this error.
So i guess it's not a path's problem but I've no idea what it could be.
Hope I could make it clear!
I'm using node.js and express.
You need to make routes to the assets.
app.use(express.static('image_folder')
Whenever you are using an asset there are multiple ways to include that in your project.
In your case, whenever an image is loaded it is actually loaded by the browser using network calls from client side. Not server side. So client side code doesn't have access to internal paths (for ex: /usr/local/ kinda paths). Whenever they fetch something it is relative to the host, maybe in your case localhost so, fetching /image.png is fetching localhost/image.png but your app doesn't have route to those image files. So, we make routes for all the assets which is done by express.static
Another way is you can actually require the image. So, bundlers (with proper config) make some public folder and put the assets to that folder. react/vue apps by default do this.

html - Pictures not showing up on Heroku?

I deployed my static HTML website to Heroku using this tutorial (http://www.lemiffe.com/how-to-deploy-a-static-page-to-heroku-the-easy-way/) and my pictures won't show up ? It works perfect locally so I don't really understand why it doesn't when it's deployed on Heroku ?
I've also looked up every other solution that stackoverflow has to offer and nothing worked for me. Any help is really appreciated
Here is the order of my folders/files (folders are capitalized):
-RESUMEAPPCOPY
-home.html
-portfolio.html
-index.php
-aboutme.html
-PUBLIC
-IMG
-JS
-CSS
Code for image:
<img src="/Users/erv/Desktop/MyProjects/resumeappcopy/public/img/PennUnitedWebsite.PNG" alt="PUSA-Icon" class="img-rounded" style="height: 300px;"/>
Whenever I inspect the element on Heroku it says :
Failed to load resource: the server responded with a status of 404 (Not Found)
and where the picture is supposed to be I have the typical broken image link picture
Your <img> tag is pointing to an absolute path that exists on your local filesystem, but does not exist for your Heroku app. Instead, provide a relative path (relative to the HTML file invoking the <img> tag, that is) to your image asset, commit the change to version control, then redeploy to Heroku.
Assuming that your public directory is actually nested within the resumeappcopy directory, the following path should work:
<img src="public/img/PennUnitedWebsite.png" alt="PUSA-Icon" class="img-rounded" style="height: 300px;"/>
UPDATE:
Note that the cited asset URL points to an asset with the file extension PNG in uppercase. However, the file's actual file extension is png – in lowercase (see here). Your local filesystem is probably insensitive to case when looking up a resource – but Heroku is not. You'll need to ensure that you're properly invoking the correct casing for resources when you deploy to Heroku.
I had the same problem and found the problem to be the capitalized file type ('.PNG'). I believe Heroku is searching for files without any .toLowerCase() function applied. Which means you must request an exact match between your markup and your file with capitalization being important.
This wasn't a problem on my local node / express server but became an issue after deploying to Heroku. Some of my images were showing up but others were getting 404 errors (i.e. the ones with capitalized file types). The smart thing to do is to always make your file types are lower case.
I changed this:
<img src="public/img/PennUnitedWebsite.PNG" alt="PUSA-Icon" class="img-rounded" style="height: 300px;"/>
To this:
<img src="public/img/PennUnitedWebsite.png" alt="PUSA-Icon" class="img-rounded" style="height: 300px;"/>
I hope this helps anybody that came across this issue as it confused me for at least an hour. Good luck!
You are giving an absolute path to the image:
/Users/erv/Desktop/MyProjects/resumeappcopy/public/img/PennUnitedWebsite.PNG
The image works locally, but cause this directory exists on your local machine; it does not exist on Heroku.
You need to use a path that is relative to the directory being served by Heroku / your server:
/../PUBLIC/img/PennUnitedWebsite.PNG
(this assumes that your link exists in an HTML file in the RESUMEAPPCOPY directory)
The only answer that hits the nail right on the head: Heroku is case-sensitive!
Took me half a day to figure that out!
Well , whenever your Web-page's contain HTML, CSS and JavaScript , so follow just 2 steps :
1) Make one file give name as index.html (keep evreything in it) ex:script,stylesheet & body.
2) Now, change these file, copy and paste these same file but change domain to index.php
Then deploy on a Heroku , Keep your images downloaded in one folder with index.html
Hence this method will help you to deploy your Web-Pages
In summary, to properly load the images:
1) Use relative url path relative to index.html
2) image file extension needs to be png instead of jpg, and write it in lower case, eg: "cat.png"
Heroku is case sensitive with images so make sure all your images are set to lowercase names.
Referencing from the frontend view "catPicture.png" won't work but "catpicture.png" will work. It's a big quirk! Took me hours to solve this.
If the image has a large size it will not load on the Heroku on a free version.
You can resize the image in an image editor (ie: paint) to reduce the size but it will also reduce quality.
Then push by the following commands
git add .
git commit -m "resize"
git push heroku master
It should work 👍👍
I had the same problem: case-sensitive png files. But to fix the issue I suggest lowerCasing them AND changing the name of the image file. This way you can be safe (and more organized in your versions) when you commit them to git and push to heroku
I had the same problem.
change the jpg image file to png.
worked for me
I had similar problem recently on Windows OS. Pictures loaded properly when tested localy, but on heroku some of the pictures were loading while others where not. And pictures were in the same folder! My paths and script were correct, but as others mentioned it was a case-sensitivity problem. I renamed the files, uploaded again but it didn't help. Why? Because changing the letter case is not recognized as real change for git on windows. To properly load newly named files i did those steps (all commands can be found at heroku tutorial pages):
Destroy heroku app and make a new one
Delete .git folder from your directory
Create new git remote for your app
Push all your files again
This way, heroku files will have names of files the way you like. Worked for me.

Java EE Web App - Image path configuration

I have implemented image upload feature but I am facing issue with its path configuration.
I want to store the uploaded the images outside of webapp root directory because every time I un-deploy the application, it deletes the images within the application.
Now, I can store the the uploaded file by getting the path from property file [say C:\images] but when I use that path in it doesn't show the file in web page.
Can you please let me know how to get the absolute path in img src tag.
For security reasons, you can't reference files outside of the webapp root. You're going to need to use virtual directories. These will map outside paths into accessible URLs so c:\images will be accessible as myapp.com/myapp/images/
This sort of thing is specific to the application server you are running, so you'll need to check the documentation for your system to make this work.

Problem retrieving a file that is outside root directory

I have a problem retrieving a flash file that is outside of the root directory.
What I have are 5 websites that use the same flash file, so I created a folder outside (one level up) of the 5 domains on my server. In the folder I have my flash file.
I am using the relative path below, but no worky worky.
"../resources/helpful_info.swf"
If I move the resource file and website files under a single domain it works fine. So, it seems I have a problem when I use a relative path and jump outside the domain to search for a file.
I don't want to use absolute path because files and paths change too much here.
Any ideas? I need it to worky worky
THANKS!
Your path does not make sense.
Relative paths are interpreted by the client, and they're used to compose a path within your domain.
You cannot use a relative path to tell the client to fetch a file outside the domain.
You also cannot reference outside your site at server side. Think security.
I see 2 fast solutions:
1) Create a new domain put the flash there. Other security problems like cross site scripting might occur.
2) Make a copy of the flash for all 5 domains. It is it update often create a script to copy it to every domain.