Addeventlistener for FLVPlayback VideoError
Hello
I am really stuck on finding a solution to detect when a connection problem is present on the FLVPlayback component:
If I try the following:
V1.addEventListener (VideoError.NO_CONNECTION, sourceFailed);
function sourceFailed (e:VideoError):void
var vError:uint = 1000;
if (e == VideoError(vError))
trace("3 - VideoError: " + e)
trace("3b - VideoError: " + e)
I get the error: Scene 1, Layer 'Scripts', Frame 1, Line 96 1067: Implicit coercion of a value of type uint to an unrelated type String.
can anyone suggest a code snipplet that works?
Many many thanks
apologies, but in the code above gives these errors:
Scene 1, Layer 'Scripts', Frame 1, Line 105 1061: Call to a possibly undefined method toString through a reference with static type fl.video:VideoError. (line 105 is : trace("3 - VideoError: " + e.toString());)
Scene 1, Layer 'Scripts', Frame 1, Line 108 1061: Call to a possibly undefined method toString through a reference with static type fl.video:VideoError. (line 108 is : trace("3 - VideoError: " + e.toString());)
Scene 1, Layer 'Scripts', Frame 1, Line 96 1067: Implicit coercion of a value of type uint to an unrelated type String. (line 96 is: V1.addEventListener (VideoError.NO_CONNECTION, sourceFailed);)
The issue seems to be in the VideoError listener, even leaving just something like:
V1.addEventListener (VideoError.NO_CONNECTION, sourceFailed);
function sourceFailed (e:VideoError):void { trace ("VideoError") }
Still gives the eror: Scene 1, Layer 'Scripts', Frame 1, Line 96 1067: Implicit coercion of a value of type uint to an unrelated type String.
Similar Messages
-
Hi ..
I am trying to create a custom skin for the FLVPlayback componenet... I was wondering if someone could point me in a direction of a comprehensive tutorial..
Thanks a bunch!!Hello,
I have been attempting to use this code with the FLVPlayback
component - when tested, the component and placeholder image both
load, but once the user hits the play button I get an error code:
ArgumentError: Error #2025: The supplied DisplayObject must
be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at video_fla::MainTimeline/removePF()
The video still plays, but the placeholder image doesn't get
removed.
This is the actionscript I'm using:
import fl.video.VideoEvent;
var pfContainer:MovieClip = new MovieClip();
myPlayer.addChildAt(pfContainer, 1);
var pf:Loader = new Loader();
pf.load(new URLRequest('slatepf.png'));
pfContainer.addChild(pf);
pfContainer.x = 0;
pfContainer.y = 0;
myPlayer.addEventListener(VideoEvent.PLAYING_STATE_ENTERED,
removePF);
function removePF(e:Event):void{
removeChild(pfContainer);
Any help would be appreciated. Thanks! -
I am working with Playing FLVPlayBack Video. i was wondering about what is best practice to use buffer time? and how exactly buffer behaves while video is in play , pause and stop states?
If i set my FLVPlayBack instance buffer time to 30 sec,
Is it contiguously keep 30 secs video in buffer. for e.g
if video is on 15 sec , then it will be having upto 45 sec stream in buffer ,
for 25 it will have 55 sec stream ,
for 1.10 it have 1.40 sec stream and so on.. ??
do it behave same as of in play , in pause and stop states . and if behaves diff. then what is the diff.I thought that might be the answer, as it is the answer for
the AS 2.0 way of doing it.
I figured the AS 3.0 equivalent would be something much more
complicated and crazy. -
Need Preloader for FLVplayback Component
Hi,
I'm playing external .flv videos using the 'FLVplayback'
component. My client's complaining that they stall and stutter a
bit when they start to stream, and wants to know if I can create a
preloader for them.
Can anyone help or point me in the right direction to create
preloaders for this component? Since the .flv is not on the
timeline, I don't know where to begin. I found some info on this in
the Flash Help files, but it's a little over my head.
Thanks very muchHey metrov,
ActionScripting is the way to go for this situation. Try this
link (hope it helps)...
http://www.actionscript.org/forums/showthread.php3?t=105158
Jaythan -
Using addEventListener for Enter and Exit frame
hi , sometimes i want to set some function in specific frame in start and exit this frame
for example i have Flv player in frame 20 , i have background sound ( mp3 player ) so i want when swf goes to this frame my sound goes Off and when Exit from it and go to another frames the sound played again ...
i put these script in frame 20 :
addEventListener(Event.ENTER_FRAME,enterfunc);
function enterfunc(e:Event):void {
trace("I started");
addEventListener(Event.EXIT_FRAME,exitfunc);
function exitfunc(e:Event):void {
trace("will Exit");
but after test movie i see I started and will Exit runs Repeatly without stoping !!
Notice : first i put my sndChannel = soundClip.play; and sndChannel = soundClip.stop; but my music runs over and over and finally my system Hanged and need to Restart so i use trace to see
so whats a problem ? thanks for spending time and help mekglad wrote:
// in frame 1:
function f():void{
trace("function f is executing when the playhead is in frame:", this.currentFrame);
// in frame 2:
f();
This works well For Excute Function on entering Frame Once !! thanks ...
but Only 1 More Question :
as You told me in your No.2 Replay :
I try to add some movieclip with instance name Or FLv playback with instance name and then Try to use this codes :
mymc.addEventListener(Event.ADDED_TO_STAGE, addedF);
function addedF(e:Event):void{
trace("I Start");
mymc.addEventListener(Event.REMOVED_FROM_STAGE, removedF);
function removedF(e:Event):void{
trace("I exit");
why The removedF function Works well and the addedF function not work ?!? in fact nothing Happend on Enter This Frame but on exit i see my I exit Trace !! -
Using a SMIL file for FLVPlayback
Hi All,
I am using an SMIL file referred to a few variable bitrate
clips, like
<smil>
<head>
<meta base="rtmp:/vod/" />
</head>
<body>
<switch>
<video src="mp4:sample1_150kbps.f4v"
system-bitrate="150000"/>
<video src="mp4:sample1_500kbps.f4v"
system-bitrate="500000"/>
<video src="mp4:sample1_700kbps.f4v"
system-bitrate="700000"/>
<video src="mp4:sample1_1000kbps.f4v"
system-bitrate="1000000"/>
<video src="mp4:sample1_1500kbps.f4v"
system-bitrate="1500000"/>
</switch>
</body>
</smil>
The Adobe
live
docs state that it could be integrated into FLVPlayback
component.
My question: How can I add a switch between diff bitrates
clips to a player skin? There is no switch for bandwidth as such.
When I add a SMIL list, it works fin, but plays only the 1st
clip.
How can i switch to the 2nd etc?
ThanksIt didn't work. I still get this error:
500 Internal Server Error
OracleJSP:
JSP Error:
Request URI:/InternAdressen-InternAdresProj-context-root/internadres.jsp
Exception:
java.lang.NoClassDefFoundError: _InternAdres
java.lang.Class java.lang.ClassLoader.defineClass0(java.lang.String, byte[], int, int, java.security.ProtectionDomain)
native code
java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String, byte[], int, int, java.security.ProtectionDomain)
ClassLoader.java:493
java.lang.Class java.security.SecureClassLoader.defineClass(java.lang.String, byte[], int, int, java.security.CodeSource)
SecureClassLoader.java:111
java.lang.Class oracle.jsp.app.JspClassLoader.loadClass(java.lang.String, boolean)
JspClassLoader.java:682
java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String)
ClassLoader.java:255
oracle.jsp.runtimev2.JspPageInstFacade oracle.jsp.runtimev2.JspPageInfo.getInstFacade(oracle.jsp.provider.JspClassProvider, javax.servlet.http.HttpServletRequest)
JspPageInfo.java:160
oracle.jsp.runtimev2.JspPageInstFacade oracle.jsp.runtimev2.JspPageTable.getInstFacade(javax.servlet.htt[i]Long postings are being truncated to ~1 kB at this time. -
im looking for a skin whitout rounded corners and that looks more discreet and square.
does someone have a clue where to find such a skin for the flvplayback with this kind of graphic?
for flash cs4 ac 3.0
thanks for taking timeHere is a $6 skin pack from Flash-Den that you could try:
http://flashden.net/item/flvplayback-skin-pack-v1-as3/20804
One on Flash-Components:
http://www.flashcomponents.net/component/flash_flv_playback_component_black_finish_skin_bl ue.html
A tutorial about customizing the video component skins:
http://www.adobe.com/devnet/flash/articles/custom_flvcomp.html
Hope they help! -
Hi folks,
Ronny's here again on forums, having particularly 2 (two) questions/problems to resolve:
1) Countdown Timer to the designated Date for Live-Broadcast-Event yet to take place
2) Detect End of Live Stream on FLVPlayback with FLVPlayback.isLive = true
attached is the .zip file (as3_Countdown Timer_ver 1.0.1_by Ronny Depp.zip) with all flash source files containing:
a) The FLash Source (file: timer_module.fla) - (FLA flash source file - Flash CS3 Professional, Flash Player 9, actionscript 3.0)
b) com.othenticmedia.utils.dateAndTimeManagement package including 2 .as actionscript 3.0 Class files.
i) com.othenticmedia.utils.dateAndTimeManagement.DateAndTimeManager Class in the said package. (file: DateAndTimeManager.as)
ii) com.othenticmedia.utils.dateAndTimeManagement.CountdownTimer Class in the package. (file: CountdownTimer.as)
c) The compiled SWF file version of this Application's blueprint. (file: timer_module.swf).
What i need to confirm is: ........................................................ see the next post of mine. (for Problems need to be Resolved)Problems to Resolve:
Problem#1) - Countdown Timer to the designated Date for Live-Broadcast-Event yet to take place.
Problem#2) - Detect End of Live Stream on FLVPlayback with FLVPlayback.isLive = true;
Problem#1 Description:
I need to pinpoint the Logical TimeSync Exception, i am still unable to figure out. That is I'm using a webservice in my Application to Synchronize the Time with the actual ET (eastern time) with accomodation of auto-adjustment for EDT GMT-4 (eastern daylight time) & EST GMT-5 (eastern standard time), times. I am using the zipcode: "10012" to pass it to the Web Service in urlRequest object, to retrieve the Current ET eastern time according to EDT & EST time settings for Manhattan/Brooklyn areas or others within New York, NY 10012.
Currently the Web Service is returning accurate date/time based on local EDT GMT-4 daylight time.
Is there some defined set of dates for EDT & EST times for New York region that I can check for to ensure the correct Dates/Times for Eastern Time in New York area ??? I am using NY zipcodes because i am sure to get correct ET values.
The Major Problem Part: is I need to correct the time by 2 seconds or approx. 2 secs, some millisecs.
When I retrieve the Time Value from WebService, it lags behind for 2 seconds as compared to DateObj i create using computer's local time, on my Windows XP Service Pack 2 with Automatic Updates turned-on. And I'm sure about my Windows will be having latest updates for Time Management already installed. I also added the 2 secs. to the TimeSync(ed) Date to make correction to this Date obj.
I call my custom fucntion addSeconds(dateObj:Date, secs:int) to add 2 seconds to the Date by Converting Seconds to Milliseconds.
Please comb through the as code in files attached and Help Me Out !!!
Problem#2 Description:
Secondly I need to Detect the End of Stream state while using FLVPlayback component, an rtmp:// live Stream from FLASH MEDIA SERVER.
I need to Play a YuMe Post-Roll Ad when Steam Finishes/Ends.
Live Broadcast Stream Event starts every night on Wednesdays & Saturdays exactly at 10:59 PM EDT GMT-4.
Live Events only Streams/Broadcasts the stream for 50secs. exactly. When [playback stopped] it plays a PostRoll Ad and after the CountdownTimer again comes back to life. The Next upcoming Event is calculated & the Countdown begins until Next Event's time/date is reached.
Here is the code on the frame 1 on the MainTimeline: (rest of the params like source, volume, skinAutoHide are Set using Property Inspector for FLVPlayback instance on Stage)
//myStream instance of FLVPlayback is on the Stage
myStream.isLive = true;// Frame 1 Actions in the FLA
myStream.addEventListener(VideoEvent.COMPLETE, onEndOfStream);
myStream.addEventListener(VideoEvent.STATE_CHANGE, onState);
myStream.addEventListener(String(VideoError.NO_CONNECTION), onStreamError);
myStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
/*if(myStream.stopped){
trace("tracy: "+myStream.state);
} else if(myStream.state == VideoState.STOPPED){
trace("tracy: "+myStream.state);
function onStreamError(event:VideoError) {
trace(event.code + "\n\t" + event);
function onState(event:VideoEvent) {
trace(event.state + "\n\t" + event.toString());
function onEndOfStream(event:VideoEvent) {
trace(event.state + "\n\t" + event.toString());
function netStatusHandler(event:NetStatusEvent):void {
switch (event.info.code) {
case "NetConnection.Connect.Success":
//connectStream();
break;
case "NetStream.Play.StreamNotFound":
trace("Stream not found: "/* + myStream.source*/);
break; -
FLVPlayback component connection
I would like to specify my own NetConnection instance for
FLVPlayback connection to Flash media Server 2. Is this possible,
perhaps by using the FLVPlayback.ncMgr property?
Thanks in advance as this is really stalling development of
my application, which uses multiple instances of FLVPlayback over
multiple pages... therefore I really need just one NetConnection to
FMS2.
Please note that I'm looking into the FLVPlayback component
as a more robust player inplace of my NetStream setup.
I really am stuck on this and need some help.apologies, but in the code above gives these errors:
Scene 1, Layer 'Scripts', Frame 1, Line 105 1061: Call to a possibly undefined method toString through a reference with static type fl.video:VideoError. (line 105 is : trace("3 - VideoError: " + e.toString());)
Scene 1, Layer 'Scripts', Frame 1, Line 108 1061: Call to a possibly undefined method toString through a reference with static type fl.video:VideoError. (line 108 is : trace("3 - VideoError: " + e.toString());)
Scene 1, Layer 'Scripts', Frame 1, Line 96 1067: Implicit coercion of a value of type uint to an unrelated type String. (line 96 is: V1.addEventListener (VideoError.NO_CONNECTION, sourceFailed);)
The issue seems to be in the VideoError listener, even leaving just something like:
V1.addEventListener (VideoError.NO_CONNECTION, sourceFailed);
function sourceFailed (e:VideoError):void { trace ("VideoError") }
Still gives the eror: Scene 1, Layer 'Scripts', Frame 1, Line 96 1067: Implicit coercion of a value of type uint to an unrelated type String. -
FLVPlayback source with query strings (parameters) doesn't load
Flash version: CS4
AS version: AS3
I'm currently trying to use the FLVPlayback component and pass a source FLV that's living on a cloudfront webserver. The problem is that the cloudfront requires authentication in the form of query strings in the source FLV. For example:
import fl.video.*;
var mainMovie:FLVPlayback = new FLVPlayback();
mainMovie.source = "http://www.somedomainname.com/firmware.flv?dummyquery=22";
trace(addChild(mainMovie));
As soon as I take away the "dummyquery", it works fine. When I add a query string, it breaks (nothing loads).
Here is the error output I get:
[object FLVPlayback]
VideoError: 1005: Invalid xml: URL: "http://www.somedomainname.com/firmware.flv?dummyquery=22&FLVPlaybackVersion=2.1" No root node found; if url is for an flv it must have .flv extension and take no parameters
at fl.video::SMILManager/http://www.adobe.com/2007/flash/flvplayback/internal::xmlLoadEventHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
It adds on "&FLVPlaybackVersion=2.1" to the end.
I saw a different article that said I should add a dummy variable at the end like "&dummy=.flv" because I was told that Flash is basically looking for an .flv extension at the end and you can trick it, but it doesn't work because they add on additional code.
Does anyone know how to work around this?Hey supervu,
I know you already found a workaround to make this work, just figured I'd post an alternative to editing the FLVPlayback compoent. I also am retrieving an FLV file via a .Net ASHX file. To keep both worlds happy, I used a URLRewriter module to translate for me... this one translates what I am using for the FLVPlayback component source:
http://domain.com/flv/22.flv to be resolved as http://domain.com/API/resource.ashx?ID=22
There is of course no flv folder in the root of my application...
Here is my very simple URLRewriter class in vb.net:
Imports Microsoft.VisualBasic
Imports System
Imports System.Web
Public Class URLRewriter
Implements IHttpModule
Public Sub Init(ByVal inst As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init
AddHandler inst.BeginRequest, AddressOf Me.OnBeginRequest
End Sub
Public Sub OnBeginRequest(ByVal app As Object, ByVal e As EventArgs)
Dim inst As HttpApplication = CType(app, HttpApplication)
Dim req_path As String = inst.Context.Request.Path
Dim trans_path As String = ""
Dim search As String = "/flv/"
Dim pos As Integer = req_path.IndexOf("/flv/")
If pos > -1 Then
Dim key as string = req_path.Substring(pos + search.Length, (req_path.LastIndexOf(".flv") - (pos + search.Length)))
HttpContext.Current.Response.Redirect("~/API/resource.ashx?ID=" & key )
End If
End Sub
Public Sub Dispose() Implements System.Web.IHttpModule.Dispose
End Sub
End Class
and make sure you add this to your web.config.. this will cause URLRewriter to intercept all HTTP requests, and redirect as needed.
<system.web>
<httpModules>
<add name="URLRewriter" type="[Namespace].URLRewriter"/>
</httpModules>
</system.web>
Hope this helps someone. -
Loading multiple videos in FLVPlayback
I am building a video player which should load multiple videos in a FLVPlayback.
When the loading of the first video has finished, the second one should start, using the VideoProgress Event.
My code looks like this, videos is an array with the paths to the videos:
flvPlayback.addEventListener(fl.video.VideoProgressEvent.PROGRESS, progress);
flvPlayback.addEventListener(VideoEvent.COMPLETE, onComplete);
private function progress(e:fl.video.VideoProgressEvent):void
if (e.bytesLoaded == e.bytesTotal)
if (videos.length > e.vp + 1)
flvPlayback.activeVideoPlayerIndex = e.vp + 1;
var path = videos[e.vp+1];
if (flvPlayback.source == "")
flvPlayback.load(path);
flvPlayback.activeVideoPlayerIndex = flvPlayback.visibleVideoPlayerIndex
private function onComplete(e:fl.video.VideoProgressEvent):void
if (videos.length > e.vp + 1)
// set the volume to 0 before switching to next video because of
// bug in FLVPlayback that prevents to play the sound otherwise.
var v:Number = flvPlayback.volume;
flvPlayback.volume = 0;
flvPlayback.activeVideoPlayerIndex = value;
flvPlayback.visibleVideoPlayerIndex = player.activeVideoPlayerIndex;
flvPlayback.volume = v;
flvPlayback.play();
flvPlayback.load(videos[0]);
flvPlayback.playWhenEnoughDownloaded();
Now I have the problem when I test this locally, the first video is invisible sometimes when starting to play. This is not happening everytime, but sometimes the video is not shown, but I can hear the sound, and I can see the scrubber on the seekbar moving.
I already tried to check in the progress function if the video is already playing, and if not, set a timer that will call the progress function again in 1 second. It seemed to help at first, but then it happened again. Does anyone know a workaround for this?Out of the AS3 documentation for FLVPlayback:
activeVideoPlayerIndex
A number that specifies which video player instance is affected by other application programming interfaces (APIs).
Use this property to manage multiple FLV file streams.
This property does not make the video player visible;
use the visibleVideoPlayerIndex property to do that.
A new video player is created the first time activeVideoPlayerIndex
is set to a number. When the new video player is created,
its properties are set to the value of the default video player
(activeVideoPlayerIndex == 0) except for source,
totalTime, and isLive, which are always set to the
default values (empty string, NaN, and false, respectively),
and autoPlay, which is always false (the default is true
only for the default video player, 0). The cuePoints
property has no effect, as it would have no effect
on a subsequent load into the default video player.
setting the activeVideoPlayerIndex property to 1 will create another VideoPlayer instance inside of the FLVPlayback component. I have done it, it does work, but with the mentioned problem in my first post that the first video is not visible.
So either I am doing something wrong, or there is a bug in how it is supposed to work. -
FLVPlayback with cue Points (2.0)
HI,
I'm new to working with cuePoints and listeners. i using
actionscript 2.0 and i want to make a video clip (called "video")
to stop playing and become invisible after playing for 30 seconds.
does anyone no a good cut and dry way to pull this off?
thanks.Xero000,
> great. that will certainly do the trick.
> any suggestions on making use out of the 'complete()'
event?
> could i use that instead of having to hard code in the
milliseconds?
Sure. The events all work the same for FLVPlayback, so once
you get the
process, you'll be good.
var listener:Object = new Object();
listener.complete = function(evt:Object):Void {
video.stop();
video.visible = false;
video.addEventListener("complete", listener);
Still assuming an FLVPlayback instance name of "video," the
above should
do it. In AS2, there are at least four ways to handle events
-- much more
simplified in AS3 -- but the above shows how to do it for
FLVPlayback.
You need a generic Object instance, which you may as well
call
"listener," because it listens for the events. You'll assign
a function to
the complete event, which gets stored as a property of your
listener object.
The funtion, in this case, stops, the video and hides it.
Finally, you subscribe the complete event, and that listner
object, to
the FLVPlayback instance.
David Stiller
Co-author, Foundation Flash CS3 for Designers
http://tinyurl.com/2k29mj
"Luck is the residue of good design." -
I know I can upgrade, download, purchase or any combination of these to get and use a new dropdown menu format that would work, but that is not what I want to work on learning today. Our top coder/developer is out of town right now, and I am just trying to fix a menu bar that was done in CS4 with Spry 1.6.1, and I have to believe that someone out there knows the fix to get it to work on an ipad. I can make the parent li not a link and it still does not work. Here is my .JS code:
// SpryMenuBar.js - version 0.12 - Spry Pre-Release 1.6.1
// Copyright (c) 2006. Adobe Systems Incorporated.
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of Adobe Systems Incorporated nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
SpryMenuBar.js
This file handles the JavaScript for Spry Menu Bar. You should have no need
to edit this file. Some highlights of the MenuBar object is that timers are
used to keep submenus from showing up until the user has hovered over the parent
menu item for some time, as well as a timer for when they leave a submenu to keep
showing that submenu until the timer fires.
var Spry; if (!Spry) Spry = {}; if (!Spry.Widget) Spry.Widget = {};
Spry.BrowserSniff = function()
var b = navigator.appName.toString();
var up = navigator.platform.toString();
var ua = navigator.userAgent.toString();
this.mozilla = this.ie = this.opera = this.safari = false;
var re_opera = /Opera.([0-9\.]*)/i;
var re_msie = /MSIE.([0-9\.]*)/i;
var re_gecko = /gecko/i;
var re_safari = /(applewebkit|safari)\/([\d\.]*)/i;
var r = false;
if ( (r = ua.match(re_opera))) {
this.opera = true;
this.version = parseFloat(r[1]);
} else if ( (r = ua.match(re_msie))) {
this.ie = true;
this.version = parseFloat(r[1]);
} else if ( (r = ua.match(re_safari))) {
this.safari = true;
this.version = parseFloat(r[2]);
} else if (ua.match(re_gecko)) {
var re_gecko_version = /rv:\s*([0-9\.]+)/i;
r = ua.match(re_gecko_version);
this.mozilla = true;
this.version = parseFloat(r[1]);
this.windows = this.mac = this.linux = false;
this.Platform = ua.match(/windows/i) ? "windows" :
(ua.match(/linux/i) ? "linux" :
(ua.match(/mac/i) ? "mac" :
ua.match(/unix/i)? "unix" : "unknown"));
this[this.Platform] = true;
this.v = this.version;
if (this.safari && this.mac && this.mozilla) {
this.mozilla = false;
Spry.is = new Spry.BrowserSniff();
// Constructor for Menu Bar
// element should be an ID of an unordered list (<ul> tag)
// preloadImage1 and preloadImage2 are images for the rollover state of a menu
Spry.Widget.MenuBar = function(element, opts)
this.init(element, opts);
Spry.Widget.MenuBar.prototype.init = function(element, opts)
this.element = this.getElement(element);
// represents the current (sub)menu we are operating on
this.currMenu = null;
this.showDelay = 250;
this.hideDelay = 600;
if(typeof document.getElementById == 'undefined' || (navigator.vendor == 'Apple Computer, Inc.' && typeof window.XMLHttpRequest == 'undefined') || (Spry.is.ie && typeof document.uniqueID == 'undefined'))
// bail on older unsupported browsers
return;
// Fix IE6 CSS images flicker
if (Spry.is.ie && Spry.is.version < 7){
try {
document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
this.upKeyCode = Spry.Widget.MenuBar.KEY_UP;
this.downKeyCode = Spry.Widget.MenuBar.KEY_DOWN;
this.leftKeyCode = Spry.Widget.MenuBar.KEY_LEFT;
this.rightKeyCode = Spry.Widget.MenuBar.KEY_RIGHT;
this.escKeyCode = Spry.Widget.MenuBar.KEY_ESC;
this.hoverClass = 'MenuBarItemHover';
this.subHoverClass = 'MenuBarItemSubmenuHover';
this.subVisibleClass ='MenuBarSubmenuVisible';
this.hasSubClass = 'MenuBarItemSubmenu';
this.activeClass = 'MenuBarActive';
this.isieClass = 'MenuBarItemIE';
this.verticalClass = 'MenuBarVertical';
this.horizontalClass = 'MenuBarHorizontal';
this.enableKeyboardNavigation = true;
this.hasFocus = false;
// load hover images now
if(opts)
for(var k in opts)
if (typeof this[k] == 'undefined')
var rollover = new Image;
rollover.src = opts[k];
Spry.Widget.MenuBar.setOptions(this, opts);
// safari doesn't support tabindex
if (Spry.is.safari)
this.enableKeyboardNavigation = false;
if(this.element)
this.currMenu = this.element;
var items = this.element.getElementsByTagName('li');
for(var i=0; i<items.length; i++)
if (i > 0 && this.enableKeyboardNavigation)
items[i].getElementsByTagName('a')[0].tabIndex='-1';
this.initialize(items[i], element);
if(Spry.is.ie)
this.addClassName(items[i], this.isieClass);
items[i].style.position = "static";
if (this.enableKeyboardNavigation)
var self = this;
this.addEventListener(document, 'keydown', function(e){self.keyDown(e); }, false);
if(Spry.is.ie)
if(this.hasClassName(this.element, this.verticalClass))
this.element.style.position = "relative";
var linkitems = this.element.getElementsByTagName('a');
for(var i=0; i<linkitems.length; i++)
linkitems[i].style.position = "relative";
Spry.Widget.MenuBar.KEY_ESC = 27;
Spry.Widget.MenuBar.KEY_UP = 38;
Spry.Widget.MenuBar.KEY_DOWN = 40;
Spry.Widget.MenuBar.KEY_LEFT = 37;
Spry.Widget.MenuBar.KEY_RIGHT = 39;
Spry.Widget.MenuBar.prototype.getElement = function(ele)
if (ele && typeof ele == "string")
return document.getElementById(ele);
return ele;
Spry.Widget.MenuBar.prototype.hasClassName = function(ele, className)
if (!ele || !className || !ele.className || ele.className.search(new RegExp("\\b" + className + "\\b")) == -1)
return false;
return true;
Spry.Widget.MenuBar.prototype.addClassName = function(ele, className)
if (!ele || !className || this.hasClassName(ele, className))
return;
ele.className += (ele.className ? " " : "") + className;
Spry.Widget.MenuBar.prototype.removeClassName = function(ele, className)
if (!ele || !className || !this.hasClassName(ele, className))
return;
ele.className = ele.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), "");
// addEventListener for Menu Bar
// attach an event to a tag without creating obtrusive HTML code
Spry.Widget.MenuBar.prototype.addEventListener = function(element, eventType, handler, capture)
try
if (element.addEventListener)
element.addEventListener(eventType, handler, capture);
else if (element.attachEvent)
element.attachEvent('on' + eventType, handler);
catch (e) {}
// createIframeLayer for Menu Bar
// creates an IFRAME underneath a menu so that it will show above form controls and ActiveX
Spry.Widget.MenuBar.prototype.createIframeLayer = function(menu)
var layer = document.createElement('iframe');
layer.tabIndex = '-1';
layer.src = 'javascript:""';
layer.frameBorder = '0';
layer.scrolling = 'no';
menu.parentNode.appendChild(layer);
layer.style.left = menu.offsetLeft + 'px';
layer.style.top = menu.offsetTop + 'px';
layer.style.width = menu.offsetWidth + 'px';
layer.style.height = menu.offsetHeight + 'px';
// removeIframeLayer for Menu Bar
// removes an IFRAME underneath a menu to reveal any form controls and ActiveX
Spry.Widget.MenuBar.prototype.removeIframeLayer = function(menu)
var layers = ((menu == this.element) ? menu : menu.parentNode).getElementsByTagName('iframe');
while(layers.length > 0)
layers[0].parentNode.removeChild(layers[0]);
// clearMenus for Menu Bar
// root is the top level unordered list (<ul> tag)
Spry.Widget.MenuBar.prototype.clearMenus = function(root)
var menus = root.getElementsByTagName('ul');
for(var i=0; i<menus.length; i++)
this.hideSubmenu(menus[i]);
this.removeClassName(this.element, this.activeClass);
// bubbledTextEvent for Menu Bar
// identify bubbled up text events in Safari so we can ignore them
Spry.Widget.MenuBar.prototype.bubbledTextEvent = function()
return Spry.is.safari && (event.target == event.relatedTarget.parentNode || (event.eventPhase == 3 && event.target.parentNode == event.relatedTarget));
// showSubmenu for Menu Bar
// set the proper CSS class on this menu to show it
Spry.Widget.MenuBar.prototype.showSubmenu = function(menu)
if(this.currMenu)
this.clearMenus(this.currMenu);
this.currMenu = null;
if(menu)
this.addClassName(menu, this.subVisibleClass);
if(typeof document.all != 'undefined' && !Spry.is.opera && navigator.vendor != 'KDE')
if(!this.hasClassName(this.element, this.horizontalClass) || menu.parentNode.parentNode != this.element)
menu.style.top = menu.parentNode.offsetTop + 'px';
if(Spry.is.ie && Spry.is.version < 7)
this.createIframeLayer(menu);
this.addClassName(this.element, this.activeClass);
// hideSubmenu for Menu Bar
// remove the proper CSS class on this menu to hide it
Spry.Widget.MenuBar.prototype.hideSubmenu = function(menu)
if(menu)
this.removeClassName(menu, this.subVisibleClass);
if(typeof document.all != 'undefined' && !Spry.is.opera && navigator.vendor != 'KDE')
menu.style.top = '';
menu.style.left = '';
if(Spry.is.ie && Spry.is.version < 7)
this.removeIframeLayer(menu);
// initialize for Menu Bar
// create event listeners for the Menu Bar widget so we can properly
// show and hide submenus
Spry.Widget.MenuBar.prototype.initialize = function(listitem, element)
var opentime, closetime;
var link = listitem.getElementsByTagName('a')[0];
var submenus = listitem.getElementsByTagName('ul');
var menu = (submenus.length > 0 ? submenus[0] : null);
if(menu)
this.addClassName(link, this.hasSubClass);
if(!Spry.is.ie)
// define a simple function that comes standard in IE to determine
// if a node is within another node
listitem.contains = function(testNode)
// this refers to the list item
if(testNode == null)
return false;
if(testNode == this)
return true;
else
return this.contains(testNode.parentNode);
// need to save this for scope further down
var self = this;
this.addEventListener(listitem, 'mouseover', function(e){self.mouseOver(listitem, e);}, false);
this.addEventListener(listitem, 'mouseout', function(e){if (self.enableKeyboardNavigation) self.clearSelection(); self.mouseOut(listitem, e);}, false);
if (this.enableKeyboardNavigation)
this.addEventListener(link, 'blur', function(e){self.onBlur(listitem);}, false);
this.addEventListener(link, 'focus', function(e){self.keyFocus(listitem, e);}, false);
Spry.Widget.MenuBar.prototype.keyFocus = function (listitem, e)
this.lastOpen = listitem.getElementsByTagName('a')[0];
this.addClassName(this.lastOpen, listitem.getElementsByTagName('ul').length > 0 ? this.subHoverClass : this.hoverClass);
this.hasFocus = true;
Spry.Widget.MenuBar.prototype.onBlur = function (listitem)
this.clearSelection(listitem);
Spry.Widget.MenuBar.prototype.clearSelection = function(el){
//search any intersection with the current open element
if (!this.lastOpen)
return;
if (el)
el = el.getElementsByTagName('a')[0];
// check children
var item = this.lastOpen;
while (item != this.element)
var tmp = el;
while (tmp != this.element)
if (tmp == item)
return;
try{
tmp = tmp.parentNode;
}catch(err){break;}
item = item.parentNode;
var item = this.lastOpen;
while (item != this.element)
this.hideSubmenu(item.parentNode);
var link = item.getElementsByTagName('a')[0];
this.removeClassName(link, this.hoverClass);
this.removeClassName(link, this.subHoverClass);
item = item.parentNode;
this.lastOpen = false;
Spry.Widget.MenuBar.prototype.keyDown = function (e)
if (!this.hasFocus)
return;
if (!this.lastOpen)
this.hasFocus = false;
return;
var e = e|| event;
var listitem = this.lastOpen.parentNode;
var link = this.lastOpen;
var submenus = listitem.getElementsByTagName('ul');
var menu = (submenus.length > 0 ? submenus[0] : null);
var hasSubMenu = (menu) ? true : false;
var opts = [listitem, menu, null, this.getSibling(listitem, 'previousSibling'), this.getSibling(listitem, 'nextSibling')];
if (!opts[3])
opts[2] = (listitem.parentNode.parentNode.nodeName.toLowerCase() == 'li')?listitem.parentNode.parentNode:null;
var found = 0;
switch (e.keyCode){
case this.upKeyCode:
found = this.getElementForKey(opts, 'y', 1);
break;
case this.downKeyCode:
found = this.getElementForKey(opts, 'y', -1);
break;
case this.leftKeyCode:
found = this.getElementForKey(opts, 'x', 1);
break;
case this.rightKeyCode:
found = this.getElementForKey(opts, 'x', -1);
break;
case this.escKeyCode:
case 9:
this.clearSelection();
this.hasFocus = false;
default: return;
switch (found)
case 0: return;
case 1:
//subopts
this.mouseOver(listitem, e);
break;
case 2:
//parent
this.mouseOut(opts[2], e);
break;
case 3:
case 4:
// left - right
this.removeClassName(link, hasSubMenu ? this.subHoverClass : this.hoverClass);
break;
var link = opts[found].getElementsByTagName('a')[0];
if (opts[found].nodeName.toLowerCase() == 'ul')
opts[found] = opts[found].getElementsByTagName('li')[0];
this.addClassName(link, opts[found].getElementsByTagName('ul').length > 0 ? this.subHoverClass : this.hoverClass);
this.lastOpen = link;
opts[found].getElementsByTagName('a')[0].focus();
//stop further event handling by the browser
return Spry.Widget.MenuBar.stopPropagation(e);
Spry.Widget.MenuBar.prototype.mouseOver = function (listitem, e)
var link = listitem.getElementsByTagName('a')[0];
var submenus = listitem.getElementsByTagName('ul');
var menu = (submenus.length > 0 ? submenus[0] : null);
var hasSubMenu = (menu) ? true : false;
if (this.enableKeyboardNavigation)
this.clearSelection(listitem);
if(this.bubbledTextEvent())
// ignore bubbled text events
return;
if (listitem.closetime)
clearTimeout(listitem.closetime);
if(this.currMenu == listitem)
this.currMenu = null;
// move the focus too
if (this.hasFocus)
link.focus();
// show menu highlighting
this.addClassName(link, hasSubMenu ? this.subHoverClass : this.hoverClass);
this.lastOpen = link;
if(menu && !this.hasClassName(menu, this.subHoverClass))
var self = this;
listitem.opentime = window.setTimeout(function(){self.showSubmenu(menu);}, this.showDelay);
Spry.Widget.MenuBar.prototype.mouseOut = function (listitem, e)
var link = listitem.getElementsByTagName('a')[0];
var submenus = listitem.getElementsByTagName('ul');
var menu = (submenus.length > 0 ? submenus[0] : null);
var hasSubMenu = (menu) ? true : false;
if(this.bubbledTextEvent())
// ignore bubbled text events
return;
var related = (typeof e.relatedTarget != 'undefined' ? e.relatedTarget : e.toElement);
if(!listitem.contains(related))
if (listitem.opentime)
clearTimeout(listitem.opentime);
this.currMenu = listitem;
// remove menu highlighting
this.removeClassName(link, hasSubMenu ? this.subHoverClass : this.hoverClass);
if(menu)
var self = this;
listitem.closetime = window.setTimeout(function(){self.hideSubmenu(menu);}, this.hideDelay);
if (this.hasFocus)
link.blur();
Spry.Widget.MenuBar.prototype.getSibling = function(element, sibling)
var child = element[sibling];
while (child && child.nodeName.toLowerCase() !='li')
child = child[sibling];
return child;
Spry.Widget.MenuBar.prototype.getElementForKey = function(els, prop, dir)
var found = 0;
var rect = Spry.Widget.MenuBar.getPosition;
var ref = rect(els[found]);
var hideSubmenu = false;
//make the subelement visible to compute the position
if (els[1] && !this.hasClassName(els[1], this.MenuBarSubmenuVisible))
els[1].style.visibility = 'hidden';
this.showSubmenu(els[1]);
hideSubmenu = true;
var isVert = this.hasClassName(this.element, this.verticalClass);
var hasParent = els[0].parentNode.parentNode.nodeName.toLowerCase() == 'li' ? true : false;
for (var i = 1; i < els.length; i++){
//when navigating on the y axis in vertical menus, ignore children and parents
if(prop=='y' && isVert && (i==1 || i==2))
continue;
//when navigationg on the x axis in the FIRST LEVEL of horizontal menus, ignore children and parents
if(prop=='x' && !isVert && !hasParent && (i==1 || i==2))
continue;
if (els[i])
var tmp = rect(els[i]);
if ( (dir * tmp[prop]) < (dir * ref[prop]))
ref = tmp;
found = i;
// hide back the submenu
if (els[1] && hideSubmenu){
this.hideSubmenu(els[1]);
els[1].style.visibility = '';
return found;
Spry.Widget.MenuBar.camelize = function(str)
if (str.indexOf('-') == -1){
return str;
var oStringList = str.split('-');
var isFirstEntry = true;
var camelizedString = '';
for(var i=0; i < oStringList.length; i++)
if(oStringList[i].length>0)
if(isFirstEntry)
camelizedString = oStringList[i];
isFirstEntry = false;
else
var s = oStringList[i];
camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
return camelizedString;
Spry.Widget.MenuBar.getStyleProp = function(element, prop)
var value;
try
if (element.style)
value = element.style[Spry.Widget.MenuBar.camelize(prop)];
if (!value)
if (document.defaultView && document.defaultView.getComputedStyle)
var css = document.defaultView.getComputedStyle(element, null);
value = css ? css.getPropertyValue(prop) : null;
else if (element.currentStyle)
value = element.currentStyle[Spry.Widget.MenuBar.camelize(prop)];
catch (e) {}
return value == 'auto' ? null : value;
Spry.Widget.MenuBar.getIntProp = function(element, prop)
var a = parseInt(Spry.Widget.MenuBar.getStyleProp(element, prop),10);
if (isNaN(a))
return 0;
return a;
Spry.Widget.MenuBar.getPosition = function(el, doc)
doc = doc || document;
if (typeof(el) == 'string') {
el = doc.getElementById(el);
if (!el) {
return false;
if (el.parentNode === null || Spry.Widget.MenuBar.getStyleProp(el, 'display') == 'none') {
//element must be visible to have a box
return false;
var ret = {x:0, y:0};
var parent = null;
var box;
if (el.getBoundingClientRect) { // IE
box = el.getBoundingClientRect();
var scrollTop = doc.documentElement.scrollTop || doc.body.scrollTop;
var scrollLeft = doc.documentElement.scrollLeft || doc.body.scrollLeft;
ret.x = box.left + scrollLeft;
ret.y = box.top + scrollTop;
} else if (doc.getBoxObjectFor) { // gecko
box = doc.getBoxObjectFor(el);
ret.x = box.x;
ret.y = box.y;
} else { // safari/opera
ret.x = el.offsetLeft;
ret.y = el.offsetTop;
parent = el.offsetParent;
if (parent != el) {
while (parent) {
ret.x += parent.offsetLeft;
ret.y += parent.offsetTop;
parent = parent.offsetParent;
// opera & (safari absolute) incorrectly account for body offsetTop
if (Spry.is.opera || Spry.is.safari && Spry.Widget.MenuBar.getStyleProp(el, 'position') == 'absolute')
ret.y -= doc.body.offsetTop;
if (el.parentNode)
parent = el.parentNode;
else
parent = null;
if (parent.nodeName){
var cas = parent.nodeName.toUpperCase();
while (parent && cas != 'BODY' && cas != 'HTML') {
cas = parent.nodeName.toUpperCase();
ret.x -= parent.scrollLeft;
ret.y -= parent.scrollTop;
if (parent.parentNode)
parent = parent.parentNode;
else
parent = null;
return ret;
Spry.Widget.MenuBar.stopPropagation = function(ev)
if (ev.stopPropagation)
ev.stopPropagation();
else
ev.cancelBubble = true;
if (ev.preventDefault)
ev.preventDefault();
else
ev.returnValue = false;
Spry.Widget.MenuBar.setOptions = function(obj, optionsObj, ignoreUndefinedProps)
if (!optionsObj)
return;
for (var optionName in optionsObj)
if (ignoreUndefinedProps && optionsObj[optionName] == undefined)
continue;
obj[optionName] = optionsObj[optionName];Try the following changes to the JS file
Lines 103 and 104 change the values
this.showDelay = 100; // was 250
this.hideDelay = 200; // was 600
Comment out line 286
Spry.Widget.MenuBar.prototype.bubbledTextEvent = function()
// return Spry.is.safari && (event.target == event.relatedTarget.parentNode || (event.eventPhase == 3 && event.target.parentNode == event.relatedTarget));
Comment out line 366 and add new lines 366 and 367
var self = this;
this.addEventListener(listitem, 'click', function(e){self.Click(listitem, e);}, false);
this.addEventListener(listitem, 'click', function(e){self.mouseOver(listitem, e);}, false);
// this.addEventListener(listitem, 'mouseover', function(e){self.mouseOver(listitem, e);}, false);
this.addEventListener(listitem, 'mouseout', function(e){if (self.enableKeyboardNavigation) self.clearSelection(); self.mouseOut(listitem, e);}, false);
I have not tested the above changes ontouch screens; they do seem to work Ok on desktops.
NOTE: Line numbers could be different because of the difference in our versions. -
Hello,
I'm having issues with the seekbar handle for FLVplayback
components. I have separate videos in separate movieclips and when
I click to a new one the seekbar handle gets left from the previous
one. I've noticed other people having the same problem but haven't
found a solution as yet, can anyone help? Is there code to prevent
this and if so would it go into the button, component or AS frame??
Any help would be greatly appreciated.
DavidThat is my plan to use playheadupdate. I have been able to add a mouse click to the seekbar itself and can seek the the correct place in the flv on demand. My problem is that I am unable to display the handle rectangle. I am also unable to add a mouse event to the SeekBarHandle class I have.
-
Flash CS3 FlvPlayback Skin Stop Button is working as pause
Hi,
I am using the skin for FlvPlayback player I have selected the sking from given list of skin.
The issue is When I select the skin which is having Stop Button, Stop Button is not stopping the video is it just pause the video and after click of play button it should start from begining of the video which is expected bevhaviour of Stop button.
any one can help me to resolve this issue.
Thanks in advance.
SangatiYup, that is how it works. You can't control which state a button is in. So when you click on it, it will go to the down state and when you let go it will go back to over (or up if you release outside).
Not sure exactly what the "fix" is. It depends upon what you are trying to do. Generally you would need to use MovieClips instead of buttons with event handlers to tell you "button" what to do. Very few people I know actually use buttons.
Maybe you are looking for
-
Cannot backup iPhone 4S to iTunes due to an error
I continue to get an error message without a specific error code when trying to sync and update my iPhone 4S (5.1) to iTunes (10.6.1). This started after an Apple Techincian had me restore the iPhone because I was having WiFi issues, which continued
-
I can't save files to my desktop. I have no problem saving the same file anywhere else. WHen I try through excel, for example, it tells me the file is read only. When I try to save it as a different file name, a pop up tells me I do not have permis
-
SharePoint 2013 Default page issue
Hi We have weird issue with SharePoint 2013 welcome page. When I browse www.mydomain.com its working just fine I don't see /pages/default.aspx however when I browse without www ex: mydomain.com its taking me to mydomain.com/pages/default.aspx even t
-
Editing onClick attribute of an ActionLink
Hi, I want to create a Disconnect link on my JSF application. I would like to have a JavaScript confirmation of the disconnection before it is done. The problem is that JSC automatically generates the onClick method of my actionLink and so I cannot o
-
Why are the following processes always using lots of memory?
Can someone tell me why the following processes are always using lots of memory and are always running? kernel_task 280MB java 300MB clamd 120MB mds 100MB WindowServer 100MB coreservicesd 60MB