Problem controlling SWF from javascript - javascript

Quite simply, I have a SWF embedded in an HTML web page and want to move to a specific frame when a trigger is clicked.
But nothing happens when I click the trigger, as though the js just doesnt communicate at all with the swf.
SWF is written in flash cs4 (a3)
The link to the website is http://simplywebdzine.com/test.html.
I have read the text books over and over and researched high and wide on the internet and as far as I see I have done everything correctly but I cannot get this to work.
The swf is very basic, just a green box moving accross a small stage.
The desired gotoframe would make it cross at a lower height (just a dry run for a more complicated swf)
Would really appreciate someones help if you could possibly find out from the source code what is going wrong.
Many thanks
Steve

It looks to me like you have two problems.
You do not have the correct id for your <object> according to your javascript. The object id is "mymovi.swf" while your javascript is targeting "mymovi" as the id.
Even if I change your id using firebug, the function still does not fire off in the flash and I get an error about the function not existing.
Have you added a callback method in flash? something like flash.external.ExternalInterface.addCallback("GotoFrame", gotoFrameHandler) ??

Related

How to set the encoding of an embedded text iframe

I am here asking about document embedding in HTML.
In a project I am working on, I am embedding my update logs as text files directly into my page, with a selection menu to view all the different updates.
The problem I am having, is not really much of a problem, being that they are plain text files, but the Firefox (have not tested elsewhere yet) console spits out a "No character encoding in the iframe document" warning.
I have searched far and wide for a solution to this problem, only to find that every solution is specifically main-level document based, like "put a tag in the html header", which I already have done from the start. I just use this:
<embed id="update_display" src="some_latest_update_file.txt" />
The embed seems to create an iframe, with the text file as the source. This works fine for me, where I am just displaying the updates. But what I am trying to control is the warning, I don't want to see the warning for something stupid like that. I know I can display my updates differently, but I would like to keep the current method if possible.
Is there a way to set the encoding of the iframe, without actually knowing the id or anything about what the embed will create?
It creates an entirely different document within my document, with it's own html, head, body and such tags. I would greatly appreciate any answer for this, as I want to keep my console clean and warning/error free.
I never actually ended up sticking with this, I just used <object src='somefile'></object> instead and included the encoding in the source file.

Animated Shortcut Icons

I was just creating an shortcut icon (the icon displayed in the head part of a page before the page title) (EDIT: I mean favicon...) for a webside, when I was thinking about animated shortcut icons (acually I don't know if they are called like that...).
Even though my intuition told me that this is probably impossible, since I haven't seen it being done on any web pages so far, I wanna be sure :^)
I have actually thought about a things that might in theory help to find out if, or how it's possible:
Using a gif file
There might be a way to make it work using a gif, but probably not. That's too easy. It would be widely-used...
Changing the icon tag using js for every frame of the icon animation
This would actually be my best guess, but I can't get it to work...
Changing the icon image on the server 10 times per second
Forget about this one.
Find out how the loding icon animation is done
Well, it's probably browser side and hasn't todo anything with html/js, but who knows?!
So, that's everything I could think of concerning shortcut icon animations, hopefully you can make sense of it :)

Is it possible to access DOM information from embedded file using jquery?

My objective: add a way for users to print attached files that are linked to a report when printing the report.
I am trying to do it this way so I can embed them and print it all in one file(users mostly use print to pdf) so I would like to have an embedded object that is the exact height it needs for the document so there is no scroll bar and the embeded items are appended and viewable in the same file.
I have found that with Chrome, when pdfs are embedded there is html information that I could use to do this, but I have no idea how to access it from the parent page.
Below are some screenshots of an example in w3 schools tryit editor. the object I need to access is the div #sizer because it is the height the window needs to be to hold the pdf with no overflow.
I have tried a lot of different jquery selectors in order to try this but continue to get "undefined" as an output for all of the selectors I try.
I have read some documentation about content scripts, but am not sure how to use them or if it would solve my problem. I have also looked at using PDF.js but it hasn't worked so far.
If anyone knows if this is possible any information would be awesome.
If anyone knows that this is completely impossible, please let me know so I can go about this a different way.
Solved the issue by going a separate route, I removed it from the HTML before I made a pdf.

How to add a resizable, dragable overlay to a webpage?

I'd like to make a userscript that can put an resizable, dragable overlay over a browser game. Only I don't have a clue how to start.
It'd basically have to be a div with some styling and javascript applied to it, containing an <iframe>. I'd also like to pass a string displayed in the game screen (HTML5, not Flash) to the iFrame, but this can happen through the use of $_POST and $_GET parameters, as it probably wouldn't be possible otherwise due to some kind of "cross domain policy".
Can someone get me on my way, with an example of a basic Chrome userscript, that would allow me to inject some HTML code for the overlay div into the game?
Why not use something like an existing Javascript framework (gotta love em')? I know this has been done again and again and again before. I feel like doing this sort of Javascript yourself may not really be worth your time. Usually when I see things like this, I offer the help of a framework. Couldn't hurt to check one of them one, you may end up saving yourself a lot of time coding something that's been done before and tested through time.

hide html page source

Is there is any way to hide asp.net page view source?
If you mean, can you hide your ASP.NET code: it's not visible in View Source.
If you mean can you hide your HTML: you can discourage casual peeking by creating your HTML on the fly via Javascript or AJAX, but a developer will always be able to see what you are doing, using simple tools like Firebug and Fiddler.
Edited to add:
I wasn't thinking of obfuscation (though that also discourages casual peeking), I was thinking of using javascript to pull down HTML. Doing a View Source will only show a bunch of <SCRIPT> tags.
But it appears his question has been revised to go in a different direction anyway, to can I keep people from downloading my images, and the answer to that is a simple no. Making money from small numbers of images is not a viable business model. (If you have thousands of images, that's another story.)
Edited to add:
The conventional way of making a catalog of photographs is to [a] show low-resolution previews, [b] put a watermark on each image (here's an example), or both.
Are you talking about ASP.NET or the result? Since ASP.NET is server-sided, it simply returns HTML. Basically, your ASP.NET file is processed by the server and variables and functions are converted into HTML. Your users can view the HTML but not the ASP.NET as it resides on server.
No, there is no way to hide the html source of a page. It's just not possible. There are tools that will promise the ability to do this, but don't believe them. Consider that it might not even be a traditional web browser that downloads the html.
What you can do is obfuscate it a bit, but even that is trivial to reverse.
No, you can't hide HTML, and there's no point either. There's nothing of value in the HTML. It would take maybe a couple hours for a skilled developer to replicate the look and feel of a website without even glancing at the HTML. In fact, it would probably be easier for him to do it his way.
The ASP/code-behind, however, already isn't visible. It's processed on the server and outputs HTML. Only the HTML (and CSS etc.) makes it to the client.
Reading the comments, it appears you want to prevent users from downloading your images. You can't really do that either. You can make it a lot more difficult for users to download them by embedding the images in Flash, or a Java applet, or something like that, but a determined thief could still decompile it and nab your image. Easier yet, he could just take a screenshot and save it out.
The best you can do is restrict access to the image to only certain users by making the image source point to a script instead that runs some validation before outputting the image.
This is not true you can hide source code. One way would be to write a loop that puts a 100k /n in the source code at the top. So it will push it so far down with white space that you can see it :-)
Where there is a problem there is a way.
And for all those who dont like this. Amazon used to hide there code somehow until sometime back.

Categories