Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 2nd, 2008, 01:01 PM
Registered User
 
Join Date: May 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Controlling Flash w/Javascript

I've seen similar questions asked a dozen times and all answered the same way, but it appears that my situation is unique.

I have a .NET page with a Panel that I show/hide with link clicks. This Panel contains an <embed> flash video.

I have the video autostarting, but when I click the "close panel" link, the panel closes and the video continues to play! What I really want is for the video to STOP and THEN have the panel hide.

The way we do the panel hiding is via javascript, which simply reset the style.display of hte panel element. Then it does a "return false" to prevent the postback.

I've found numerous ways to access and control the flash object via javascript, but if I add those calls to the beginning of my "hidePanel" function, they do not do anything.

I created a separate stopFlashMovie() javascript function and it works, but only if I do NOT "return false" at the end. Unfortunately, if I do not "return false", the page posts back and, because of some fancy URL-rewriting (SEO crap I do NOT understand), the page redirects to some other place that I do NOT want.

It seems as if hte "return false" is somehow preventing the StopPlay() flash method from working.

Did this make enough sense for someone to maybe understand my dilemma and suggest a solution!???

Thanks!


 
Old May 3rd, 2008, 03:21 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Why are you using a postback control for behavior that needs to happen at the client? Couldn't this be easily solved with a control that ONLY does client side code and doesn't generate any postback script?

-Peter
compiledthoughts.com
 
Old May 6th, 2008, 05:52 PM
Registered User
 
Join Date: May 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

A very good question. Answer: Inherited code.

I'll have to do some investigation to see if I can convert this part of the page to straight client-side.

We shall see.

 
Old May 6th, 2008, 07:11 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I have dealt with a similar situation in the past and the way that I achieved it was by not using a Server Control at all. I simply used a plain old Anchor tag such as this:

<a onclick="JavascriptFunction()">Click Me</a>

You can test this yourself by placing a simplistic Javascript function on your page and replicating my code above and you will notice that no round trip to the server is made. There is one caveat to this: without the href attribute your cursor will behave differently when you hover over the link (it turns into a caret instead of the hand icon) but this can be easily fixed with a bit of CSS.

Obviously this is an elaborated explination of what Peter is suggesting but I am confused when you say: Inherited code. To me that means that this panel/video player is in someway inherited from a Base class that is providing the functionality. Is this correct or do you mean to say that you inherited this code from another developer?

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
 
Old May 19th, 2008, 09:33 AM
Registered User
 
Join Date: May 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was afraid someone would misinterpret my "inherited code" comment. Your second guess is the correct one. *I* inteherited the code from a previous developer and am attempting to ad functionality without having to rewrite the entire page... something I bet most developers have neeb through.

:)

 
Old May 21st, 2008, 06:39 PM
Registered User
 
Join Date: May 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Goodness! Did I write that mess? I must have been typing with my eyes closed while riding a horse!!

I apologize for my NUMEROUS spelling mistakes. ugh.






Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript control over flash catchrohith Classic ASP Basics 0 November 8th, 2006 05:54 AM
Flash and Javascript (VERY URGENT) Apocolypse2005 Javascript 3 July 2nd, 2006 02:12 PM
Controlling Print with Javascript arnabghosh Javascript How-To 1 August 10th, 2005 08:21 AM
calling javascript from flash Adam H-W Flash (all versions) 2 March 17th, 2004 11:26 AM
mouse controlling in flash and creating cursors mrafaqi Flash (all versions) 1 October 13th, 2003 09:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.