I use .swf file in may site:
<div>
<object width="100%" height="100%">
<embed src="#Url.Content( "~/Content/TopRight.swf" )" type="application/x-shockwave-flash" width="310" height="95"></embed>
</object>
</div>
And I want when click this banner, opens any link (any page). I placed <object> into <a> tag, but nothings changed. How can I do this?
put this at the end of your code:
import flash.display.MovieClip;
var hit = new MovieClip();
hit.graphics.beginFill(0xFFFFFF);
hit.graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight);
var clicky = new SimpleButton(null,null,null,hit);
this.addChild(clicky);
clicky.addEventListener(MouseEvent.CLICK, function(){
navigateToURL(new URLRequest("http://google.com"));
});
should work :)
Related
Hi all website development experts,
I am a newbie to website design.
I am 13 years old but my passion is to record my own music from the different instruments I play and I love singing as well.
I am trying to make my own online Music Library so that people can listen to some of my songs in full for free or listen to a preview of my songs and buy them online.
I have created an Album Web Page which displays all the songs I have uploaded to my ISP's Web Server.
I have either a Free Play or Preview Button listed for each song in the Album.
If the users click on this Image Button, I want it to change onclick to a Pause Button.
If the users then click on the Pause Image Button I want it to change back to the Free Play or Preview Button.
I also want the Song to continue to play from where the user clicked on the Pause Button until either the end of the song or the end of the preview length of 15 seconds for the song, if it is available as a Preview Song.
What is the easiest way to achieve this.
I have the following code so far:
Javascript:
<script>
function play(id){
var audio = document.getElementById('audio'+id);
audio.play();
}
function pause(id){
var audio = document.getElementById('audio'+id);
audio.pause();
}
function changSRC() {
document.getElementById("imageid").src="/images/Song_Pause.png";
}
</script>
HTML:
<html>
<body>
<audio id="audio1">
<source src="/songs/Hall-of-the-Mountain-King.mp3" type="audio/mpeg">
<source src="/songs/Hall-of-the-Mountain-King.ogg" type="audio/ogg">
</audio>
<img src="/images/Free_Play.png" align="center" width="100%" alt="Free Play" onclick="changSRC()" />
<audio id="audio2">
<source src="/songs/Rimsky-Korsakov-The-Flight-of-the-Bumble-Bee.mp3#t=0,15" type="audio/mpeg">
<source src="/songs/Rimsky-Korsakov-The-Flight-of-the-Bumble-Bee.ogg#t=0,15" type="audio/ogg">
</audio>
<img src="/images/Preview.png" align="center" width="100%" alt="Song Preview" onclick="changSRC()" />
</body>
</html>
Now I am stuck.
How do I continue on from here to get the Songs to play again from when the user clicked on the Pause Button from the point they clicked on the Pause Button until the end of the 15 second preview or until the end of the song for the Free Play songs.
I will really appreciate any help. Thank you so much in advance!
Kind Regards,
Nancy
you can put the free_play_or_preview and id parameters in "changSRC" and give parameters according to the song. In my solution if free_play_or_preview parameter is "f" image is free play image else image is preview image and you can find which element has which image with id parameter
Here is my solution :
<!DOCTYPE html>
<html>
<body>
<audio id="audio1">
<source src="/songs/Hall-of-the-Mountain-King.mp3" type="audio/mpeg">
<source src="/songs/Hall-of-the-Mountain-King.ogg" type="audio/ogg">
</audio>
<img id="img1" src="/images/Free_Play.png" align="center" width="100%" alt="Free Play" onclick="changSRC('f',1)" />
<audio id="audio2">
<source src="/songs/Rimsky-Korsakov-The-Flight-of-the-Bumble-Bee.mp3#t=0,15" type="audio/mpeg">
<source src="/songs/Rimsky-Korsakov-The-Flight-of-the-Bumble-Bee.ogg#t=0,15" type="audio/ogg">
</audio>
<img id="img2" src="/images/Preview.png" align="center" width="100%" alt="Song Preview" onclick="changSRC('p',2)" />
<script>
function play(id){
var audio = document.getElementById('audio'+id);
audio.play();
}
function pause(id){
var audio = document.getElementById('audio'+id);
audio.pause();
}
function changSRC(free_play_or_preview,id) {
if(document.getElementById(`img${id}`).src == "/images/Song_Pause.png"){
if(free_play_or_preview == "f"){
document.getElementById(`img${id}`).src == "/images/Free_Play.png"
} else {
document.getElementById(`img${id}`).src == "/images/Preview.png"
}
} else {
document.getElementById(`img${id}`).src="/images/Song_Pause.png";
}
}
</script>
</body>
</html>
I made an image into a map with images-map.com
I made some clickable areas, but i cant figure out how to make a function when i click on one of the areas. When I click on the images it will direct me to a website.
<img id="Image-Maps-Com-image-maps-2014-02-12-182158" src=images/map2.png border="0" width="491" height="360" usemap="#image-maps-2014-02-12-182158" alt="" />
<map name="image-maps-2014-02-12-182158" id="ImageMapsCom-image-maps-2014-02-12-182158">
<area shape="rect" coords="489,358,491,360" alt="Image Map" title="Image Map" href="http://www.image-maps.com/index.php?aff=mapped_users_0" />
<area id="cen" shape="poly" coords="242,117,227,117,212,143,232,175,244,173,252,169,264,166,272,161,278,155" alt="Centrum" title="Centrum" target="_self" href="http://www.image-maps.com/" />
</map>
I want to make a function that loads an ID of a highchart that I made when I click on that part of the image.
I tried to replace the href="http://www.image-maps.com/" with an id but it doesnt work
Do you mean JavaScript function? If yes, use JavaScript Framework, for example jQuery. If you use jQuery, here is simple event that will be bind to any img HTML tag.
$("img").click(function(){
alert("The image clicked");
}};
I have many posts with many images therein. I have labelled a colour for each image in the alt field. So every image has a colour.
Now I need to find AND display all images based on that colour. And Id like to still be able to link to it's parent post. So im search all wordpress images based on the alt tag's contents.
This may take some nested loops, im not sure. I doubt there is an elegant way to do this.
Can anyone help me, should look something like this:
<img src="img source" alt="blue" />
<img src="img source" alt="blue" />
<img src="img source" alt="blue" />
<img src="img source" alt="blue" />
<img src="img source" alt="blue" />
<img src="img source" alt="blue" />
I have no other php markup, i don't know where to start
Try this jQuery solution
var imgs = $('img[alt|="blue"]');
alert(imgs.length);
For more on this selector go here.
Try this if you want to use pure JavaScript solution
var imgs = document.getElementsByTagName("img");
var imgsBlue = [];
for (var i = 0; i < imgs.length; i++) {
if (imgs[i].alt == 'blue')
imgsBlue.push(imgs[i]);
}
alert(imgsBlue.toString());
<img id="Img1" class="photoBox" src="Images/DisplayImageById.ashx?number=1&userName=<%=Page.User.Identity.Name %>"/>
<img id="Img2" class="photoBox" src="Images/DisplayImageById.ashx?number=2&userName=<%=Page.User.Identity.Name %>"/>
<img id="Img3" class="photoBox" src="Images/DisplayImageById.ashx?number=3&userName=<%=Page.User.Identity.Name %>"/>
<img id="Img4" class="photoBox" src="Images/DisplayImageById.ashx?number=4&userName=<%=Page.User.Identity.Name %>"/>
<img id="Img5" class="photoBox" src="Images/DisplayImageById.ashx?number=5&userName=<%=Page.User.Identity.Name %>"/>
I have been looking for a way to show a spinning icon until the images load without using ajax? I am researching how to load images using ajax but it wasn't going to well so I started looking for a way to do this without ajax. Is that possible?
Thank you for any help.
Check this. This is done using jQuery's load event, which tells when a specific element is being loaded, in your case, img
http://jsfiddle.net/blackpla9ue/uJhCt/1/
$(function(){
$('div img').each(function(){
var thisImage = $(this);
thisImage.hide(0)
.load(function(){
$(this).show();
});
});
Note that this would not work if you put your code inside $(document).ready(function(){ ...});
My flash is working fine in all browser except ie6. During loading of page I see flash fine in ie6 but once page is loaded flash disappears. Looked everywhere but can not find solution.
in ie6 downloaded latest player WIN 10,3,181,34. version detected at http://kb2.adobe.com/cps/155/tn_15507.html
javascript file has
$(document).ready(function () {
swfobject.registerObject("mymovie", "9.0.0", "expressInstall.swf");
});
Below is code in helper in app_code folder
#helper SwfObject(string swfName, UrlHelper url) {
<object id="mymovie" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="960" height="315" style="background-color: #e6e6e6;" wmode="transparent">
<param name="movie" value="#url.Content("../../Content/flash/" + swfName)" />
<param name="wmode" value="opaque" />
<object type="application/x-shockwave-flash" data="#url.Content("../../Content/flash/" + swfName)" width="960" height="315" style="background-color: #e6e6e6;" wmode="transparent">
<div>
<img src="#url.Content("../../Content/gallery/album1/large/1.png")" alt="Image"/>
<p><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></p>
</div>
</object>
</object>
}
swfobject.registerObject shouldn't be wrapped in a $(document).ready function or any similar onload functions, such as window.onload.
Demo
Tutorial
The official example in the SWFObject documentation