Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 2nd, 2008, 01:01 PM
Registered User
 
Join Date: May 2008
Location: Seattle, WA, USA.
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!


Reply With Quote
  #2 (permalink)  
Old May 3rd, 2008, 03:21 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
Reply With Quote
  #3 (permalink)  
Old May 6th, 2008, 05:52 PM
Registered User
 
Join Date: May 2008
Location: Seattle, WA, USA.
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.

Reply With Quote
  #4 (permalink)  
Old May 6th, 2008, 07:11 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
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
================================================== =========
Reply With Quote
  #5 (permalink)  
Old May 19th, 2008, 09:33 AM
Registered User
 
Join Date: May 2008
Location: Seattle, WA, USA.
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.

:)

Reply With Quote
  #6 (permalink)  
Old May 21st, 2008, 06:39 PM
Registered User
 
Join Date: May 2008
Location: Seattle, WA, USA.
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.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 02:15 PM.


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