Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








How To Find Memory Leaks (FlvPlayer)?


Hello,

I created an application(uses FlvPlayer), which load .flv file from outside.
If I will load.flv file many times, it increases flashplayer's size drastically. Each time it increases the size by 10MB. After 30-35 attempts, it stops playing sound, it only play the video(It goes in mute mode).

Would you please tell what is the best way to dispose/distroy the loaded resource from FlvPlayer?
What things I must consider while working with FlvPlayer?
And why the FlvPlayer is playing video properly but not playing audio file?

I would appriciate your response.
Thank you.




ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 11-12-2008, 05:29 AM


View Complete Forum Thread with Replies

Sponsored Links:

Memory Leaks In Flash? Cus My Program Is Using Over 235,000kbs Of Memory
ANY HELP APPRECIATED as i've spent 2 days on this (started 2 days 3 hours ago)... please help me

I have only 16 images in my program, its a slideshow, all my images have a small image selection which on(rollOver) shows that image in a bigger screen, however when my program launches, I do ctrl + alt + del, and my memory usage for that swf file I made is at 235,000kb of memory, and my laptop can't handle it, (its 70mb) and the original .fla file is (70mb)

Is there anyway to fix this, I belive my scripts are leaking, I know for a fact, im not cleaning my locals... or globals...

if I declare a variable should I set it to null?

Question 1: Should I remove local variables? if so how do I do it?
Question 2: Should I remove global variables? if so how do I do it?
Question 3: Any other things I need to know?

this is my code for start up, which hides all images not in the first 4 places (which is suppost to be visible) the others are turned invisible...

Code:
_global.b = Array();
_global.end = 16;
_global.b[0] = btn_1;
_global.b[1] = btn_2;
_global.b[2] = btn_3;
_global.b[3] = btn_4;
_global.b[4] = btn_5;
_global.b[5] = btn_6;
_global.b[6] = btn_7;
_global.b[7] = btn_8;
_global.b[8] = btn_9;
_global.b[9] = btn_10;
_global.b[10] = btn_11;
_global.b[11] = btn_12;
_global.b[12] = btn_13;
_global.b[13] = btn_14;
_global.b[14] = btn_15;
_global.b[15] = btn_16;
_global.X = 40;
_global.Y = 30;
var t:Number = Array();
for (var i:Number = 0; i<4; i++)
{
t[i] = (i*100)+80;
}
for (var i:Number = 0; i<_global.end; i++)
{
var b = _global.b[i]._x;
_global.b[i]._x = (i*100)+t[0];
if (b != t[0] and b != t[1] and b != t[2] and b != t[3])
{
_global.b[i]._visible = false;
}
else
{
_global.b[i]._visible = true;
}
}
code for scrolling through my list of images (as it only shows 4 on the screen at one time)

basically, each image is 90 * 68 (width/height) the X position of the first image is 80, and it increments by 100 each time, until the 5th image, in which its 30, the start up code above, spaces them out by 100 (as I normally dont have enough room to fit 16+ images spaced out by 100) it also does other things

Basically, t gets the X position of last image... then

And basically hides and unhides images pending if they're X position is 80, 180, 280, 380...


Code:
on(release)
{
var t:Number = 0;
for (var i:Number = 0; i<_global.end; i++)
{
t = (i*100)+80;
}
for (var i:Number = 0; i<_global.end; i++)
{
if (_global.b[i]._x > 79)
{
if (_global.b[i]._x == 80)
{
_global.b[i]._visible = false;
_global.b[i]._x = t+100;
}
if (_global.b[i]._x > 579)
{
_global.b[i]._visible = false;
}
if (_global.b[i]._x == 480)
{
_global.b[i]._visible = true;
}
_global.b[i]._x -= 100;


}
}
}
The next code is for "enhancing" my images a little bit, it increases its Width & Height by 30 and 40... and decreases by that on rollOut / dragOut

(as you can dragOut and rollOut doesn't happen therefore I need it so you can't "increase" the image height & width without decreasing when your mouse moves off it)

Code:
on(rollOver)
{
gotoAndStop(2);
var b = btn_1
b._width = b._width + _global.X;
b._height = b._height + _global.Y;
b._x = b._x - X/2;
b._y = b._y - Y/2;

}
on(dragOut)
{
var b = btn_1;
b._width = b._width - _global.X;
b._height = b._height - _global.Y;
b._x = b._x + X/2;
b._y = b._y + Y/2;
}
on(rollOut)
{
var b = btn_1;
b._width = b._width - _global.X;
b._height = b._height - _global.Y;
b._x = b._x + X/2;
b._y = b._y + Y/2;
}
Thats it, they're basically 1 of each different thing I have... it basically stays the same, I have 32 images (large_1-16, and small_1-16)

They're exactly the same size, but I wasn't sure if I could use 1 image twice, for different things (they're size is 2500 * 1900 give or take a 100 or so)

View Replies !    View Related
Memory Leaks In AS2
Hey folks,

I am working on some *AS2* code.

Problem: Basically, I'm loading my SWF file in Firefox; and the memory
used is going upwards nonstop. After a couple of minutes, all system
resources are used and I need to restart the browser. I suspect
(obviously) a memory leak or the garbage collection not doing its proper
job.

Question: Is there some tools I can use to diagnose this problem and
retrace where the leak is coming from. Ultimately is there some garbage
collection optimization I should be aware of?

Thanks

View Replies !    View Related
Memory Leaks
I have a project that has a memory leak, and I'm having difficulty finding it. I've narrowed it down to a small code block, which includes changing the values of two dynamic textfields, one of which is html, and loading a jpeg into a container clip. All these objects are contained in a single movie clip, and the values loaded into them are stored in arrays.

Has anyone experienced memory leaks caused by html enabled textfields? It seems at this point as if the html textfield may be the cluprit. Is there a list of known memory leak causes online?

View Replies !    View Related
Memory Leaks Over Weeks
hi,
a very rare question i'm sure.
i've made a flash movie that runs on a display. this movie may run without being turned off for up to 6 months.
as it runs the memory it takes up increases. about 1mb a day.

how can i clear the memory?

View Replies !    View Related
Memory Leaks And SOAP
I have been reading about web services and how you can either use Flash Remoting or SOAP - But there are some serious memory leaks if you use SOAP. Does any know if this has been fixed?


Thanks

View Replies !    View Related
How To Detect Memory Leaks?
Just wondered how to detect them and what's the remedy?

Thanks again!

View Replies !    View Related
AS3 - Tackling Memory Leaks
So I've been working on a fairly large, AS3 app for some time now. It has tons of graphics, sounds, animations, a couple video clips, and almost 500 external class files or so. I'm just starting to notice that after extended play, some of the animations start acting a little choppy. I'm guessing I've got a memory leak.

I've determined / tracked these down before using Valgrind, but never had a reason to track them down in an AS app. Besides the obvious "dig through the code" and "handle memory efficiently to begin with" (which I thought I had), any extra tips to tackling memory leaks in AS3?

Thanks,
~JC

View Replies !    View Related
REMOVED_FROM_STAGE, RemoveEventListener(), Contains() And Memory Leaks
Hullo! This is my first post here.

I have been (teaching) scripting for many years with various systems including OOP Flash, and so I am not a beginner. I am using CS3, fwiw.

For my own projects I mostly use classes, which behave exactly as I expect them to, but I get unexpected results when putting code and display objects into the timeline during authoring. I am rather obliged to use scripts and display objects in the timeline because I am teaching ActionScript 3.0 to absolute beginners, and I know from bitter experience that going straight to classes is too great a first step.

In particular, I have various problems understanding AS3's event listener mechanism, especially as it relates to garbage collection with display objects placed on the timeline during authoring.

The problems outlined below mostly do not pertain to display objects added and removed with addChild() and removeChild() respectively.

I am sure this is 'old news' for many of you, but I haven't really been able to find solid, concise information about when (or whether) to use removeEventListener in relation to removeChild() and/or timeline navigation. I'm also having a hard time understanding the 'use weak reference' property, which appears to be relevant here somehow.

My own conclusions are that it is a wise 'rule of thumb' to removeEventListener for every event attached to a movieClip, when the movieClip is taken off stage (for example when navigating to part of the timeline where the clip is not present). That's a big pain in the AS3, especially for beginners, and perhaps worse still for those coming from AS2. Nobody likes cleaning up, least of all beginners and people that never had to clean up before.

It might be 'memory safe' (i.e. leak-free) to leave mouse and key events hooked up (how could we test, anyway?), but stuff like ENTER_FRAME definitely needs to be killed off, or the display object will just keep on keeping on, even when it's no longer 'there'.

It appears to me that the REMOVED_FROM_STAGE event is ideal for this kind of 'cleanup', no? I understand that REMOVED happens just before the object has been removed, whereas REMOVED_FROM_STAGE happens just after.

The docs are not entirely clear to me on the specific subject of display objects placed on the timeline during authoring, which are 'removed' because of timeline navigation, and whether this is supposed to be the same thing as removeChild(). My tests indicate that it is not the same thing at all.

One thing is for sure, display objects placed on the timeline in authoring do indeed get a REMOVED_FROM_STAGE event when the playback head leaves their 'scope' in the timeline.

My questions, then:If I have the 'useWeakReference' parameter as true, when I add an enterframe event listener, is it correct/by design that an object 'removed' from the stage as a result of timeline navigation continues to receive enterframe events? When does such an object get garbage-collected, then? Does the useWeakReference parameter have any meaningful effect at all when adding an enterframe event handler?

Also, what is the 'correct' frame rate to expect when an object has been removed? (Individual timelines can have their own framerate).

It seems to me that these display objects accumulate in RAM, and therefore represent a memory leak - which is what 'useWeakReference' is supposed to prevent, no? This makes me worry about leaving mouse and key events hooked up to no-longer-present movieclips, because every time we return to the timeline scope of those objects, new instances are created.

The docs say that contains() returns "true if the child object is a child of the DisplayObjectContainer or the container itself", but my tests indicate a quirk:

If the object was put on stage, and 'taken off' in a Flash timeline (rather than with addChild/removeChild), the contains() method returns true even AFTER the object is gone. Is this an error of documentation, or my own misunderstanding?

According to the docs, the parent property of a display object is set to null when the object is removed from the stage. (i.e. sometime after REMOVE and sometime before REMOVED_FROM_STAGE), but event.target.parent appears to point to the old value, even in REMOVED_FROM_STAGE events.

I even tried using a timeout of a few seconds, to give Flash a chance to set parent to null (I had to use a class to make this work), but as long as the display object was put on stage in Flash, rather than with addChild(), parent is never set to null after removal, and stage.contains(theNoLongerPresentMovieClip) will continue to return true. This strikes me as downright wrong. Works fine with objects added dynamically, however.
Is it possible to get a list of all the listeners attached to an object? I can't find anything in the docs about it.


To test this, put a movieclip (instance name "m_mc") in frame 1 only of a 2 frame movie. Notice that the parent of the dynamically added/removed object is set to null correctly, but the parent of the object added in authoring remains fixed.


ActionScript Code:
// script for frame 1

// test with object added to stage in authoring (m_mc)
m_mc.addEventListener(Event.ENTER_FRAME, foo, false, 0, true);
m_mc.addEventListener(Event.REMOVED_FROM_STAGE, foo);

// test with dynamically adding and removing a display object:
var m2_mc = new MovieClip();
m2_mc.addEventListener(Event.ENTER_FRAME, foo, false, 0, true);
m2_mc.addEventListener(Event.REMOVED_FROM_STAGE, foo);
trace("**"+stage.contains(m2_mc));
addChild(m2_mc);
trace("**"+stage.contains(m2_mc));
removeChild(m2_mc);
trace("**"+stage.contains(m2_mc));

// leave timeline scope of m_mc
//removeChild(m_mc); comment this back in for 'more correct' behavior
gotoAndStop(2);

function foo(e) {

    var et = e.target;
    var kids = stage.getChildAt(0)["numChildren"];
    var report = "";
    report += (et.name + " just got a " + e.type + " event.
");
    report += ("Main timeline has " + kids + " children.
");
    report += ("Parent of " + et.name + " is " + et.parent + "
");
    report += ("stage.contains(" + et.name + ") " + stage.contains(et) + "
");
    trace(report);
    trace("");

}

Notice also that contains() returns true in both cases in the REMOVED_FROM_STAGE event handler, but in the dynamically added/removed object, contains() functions as advertised thereafter.

This appears to indicate that event.target.parent is NOT null during a REMOVED_FROM_STAGE event, which is contrary to what the docs imply. What then is the difference between REMOVED and REMOVED_FROM_STAGE?

BTW if you removeChild(m_mc) just before going to frame 2, this discrepency disappears. Hmm. Shouldn't Flash just remove the thing properly in the first place?

Thanks in advance for anything which may enlighten me!

View Replies !    View Related
Memory Leaks With Socket And Loader
Hi,

I wrote a flash app that connects to a server ( with Socket() ) which sends out packets of binary data which represent jpeg images that form a video stream ( about 6 images/second ). I then store this data into a ByteArray and load it with Loader.loadBytes(). I works really great with one exception: it leaks memory horribly. I can't figure out exactly why it's leaking. I have read up a lot on Flash garbage collection, but I can't seem to find the problem.

Thanks!

View Replies !    View Related
Timer And SetInterval Leaks Memory
Set up a timer to tick every second (or an interval). Monitor the memory usage of your application.

You'll see that it tags on like 10kb to the memory usage every 5-6 ticks. This never gets freed.

Had something really simple like;


ActionScript Code:
public function main()         {            _timer = new Timer(1000);            _timer.addEventListener(TimerEvent.TIMER, report, false,0, true);            _timer.start();        }        private function report($e:TimerEvent):void        {                }


And nothing in the fla. So it literally does nothing but tick every 1 seconds and this increases the memory usage with 10-15kb every 4-5 seconds. I let it run for an hour and it never gets freed.

What sort of evil BS is this

View Replies !    View Related
How Can I Check My Program For CPU Usage And Memory Leaks?
I made a dynamic animation swf. I'd like to make it as lightweight as possible. Does anyone know of any tools or tricks or tips on how to optimize my code?

-thanks

View Replies !    View Related
Memory Leak...can You Find It In This Small Script?
I'm trying to understand memory leak issues and created a quick demo to try and understand something. Where is the memory leak in this? I create 5500 circles and then remove them. When I use a garbage collection and memory display script it shows that when this is run it's at 7.4MB then when the objects are created it jumps to 23MB. Finally when they are removed it comes back down but only to 7.6MB. If I were to create this over and over I'd be losing 200KB each time. What am I missing?


Code:
setTimeout(createBoxes,3000);
setTimeout(removeBoxes,6000);

var theBoxes:Sprite = new Sprite();
addChild(theBoxes);

function createBoxes(){
var myBox:Sprite;
for(var i:Number = 0; i<5500;i++){
myBox = new Sprite();
myBox.graphics.beginFill(0x00CCFF);
myBox.graphics.drawCircle(120, 40, 40);
myBox.x=2*i;
myBox.y=2*i;
theBoxes.addChild(myBox);
}
}

function removeBoxes(){
while(theBoxes.numChildren){
theBoxes.removeChildAt(0);
}
}

View Replies !    View Related
Let's Play Find The Memory Leak Yay Flash 9
I have a main fla - it loads a sub swf. The sub swf loads an xml doc, then saves the xml to a static property within a storage class. The main fla can then unload the sub swf via a public method dispose. Every thing is set to null upon the unload. Yet, after loading / unloading a dozen times or so, you'll continue to see the system memory climb - even while I'm using a temp hack to clear the system memory.

This is a trimmed example based on 8 or 10 items I'm building, that may be heavily loaded/unloaded.

Can anyone spot why the memory would continue to climb when you repetitivesly load/unload the app?? Am I blatantly missing something or will player 9, via the repetitive use, just "act this way" (imagine a replay button that will be heavily used to load / unload all of these items).

I'm really hoping someone has some advice here - I'm pulling my hair out at this point. And, I know there are a few added objects in the loading code, but this, again, is paired down from a larger set of code that utilizes those.

thanks!

files attached.

View Replies !    View Related
Handle Leaks In Flash Client, Need Guidance How To Proceed
Hi Flash Champs,
I need help regarding handle leak issue. I have a Flash movie that parses XML from the server every 1 minute. The XML file is around 100- 200 KB. I m seeing that IE starts leaking handles, and when profiled, I see a lot of "token" handle leaks (more than 2000 handles leaks per day) ( My understanding on Token Handles: It is a handle to a security credential. Usually when IE connects to a server it tries to send the credentials of the logged in user. These credentials are seen as tokens in windows.) Are there any documented issues regarding this? If I keep IE open for a week, Flash will cause IE to either crash, or make the system unstable.. I have disabled all Toolbars (except Adobe PDF toolbar)..

I use HTTP to request XML data from Server. There is JSP Session ID based authentication to connect to server before running the SWF. How do I go ahead debugging? Thanks in advance.


Some details about the Flash Movie:
There are several Actionscript Verison 2 components in the movie all instances of whihc are created at runtime using actionscript. all of my code is in Actionscript 2 There is quite some XML parsing. There are not much animations in the movie (the movie more has to do with parsing the XML and representing it in the screen).

View Replies !    View Related
FLVPlayer.complete
I have a stiff deadline for a project and AS3 is killing me. I am loading a flv file onto the stage into the FLVPlayer component. I need to have a movie clip play once the movie has concluded.

PLEASE HELP ME I AM GOING TO SCREAM.

View Replies !    View Related
Change Hue FLVPlayer
Hello there!

I did a website full-flash website with a feature that allow you to change the color of some elements (menu background, texte background...). The background of the site is a FLV video that I would change the HUE of it.

I googled to find my answer without any success. I was wondering if someone have a solution for this. I found something cool that is close the solution http://www.quasimondo.com/archives/000615.php

But I would ratter have a function that change the HUE of the Video. I already have a slider that give me a color hexec.

Thank you for helping me.

Satiss

View Replies !    View Related
FLVPlayer Mutes After First FLV
I'm using FLVPlayer, loading one FLV file, then while that is playing, changing activeVideoPlayerIndex to load a second ready to play when the first finishes.

The frst movie plays fine, but all subsequent files start with the sound muted (although the mute button says otherwise). If you click the mute button twice (ie: mute then unmute) the sounds comes back on.

Tried extending FLVPlayer and setting uiMgr._isMuted=false when the file plays, but this just affects the mute button on screen, doesn't un-mute the sound.

Any ideas why all but the first movie are muted?
Thanks.

Snippet:
>>>>>>>>>>>>>>>>>>>>>

_player = new FLVPlayback();

addChild(_player);
_player.addEventListener(VideoEvent.COMPLETE, movieFinished);
_player.skin = "SkinOverPlayMute.swf";
_player.autoPlay = false;
moviePlayNext();

...

private function moviePlayNext():void
{
var ix:int;

_player.play();
_player.volume = 1.0;

_player.visibleVideoPlayerIndex = _player.activeVideoPlayerIndex;

ix = (_player.activeVideoPlayerIndex == 0) ? 1 : 0;
_player.activeVideoPlayerIndex = ix;
_player.source = nextMovie(); // Get next filename to load
_player.seek(0);
}

private function movieFinished(ev:VideoEvent):void
{
moviePlayNext();
}

>>>>>>>>>>>>>>>>>>>>>>>>>

View Replies !    View Related
FLVPlayer Compatible With C#.net 2.0
hi,

Can somebody pls. provide me the link for FLVPlayer which is compatible with c#.net 2.0.
I need to allow users to upload their video files in any valid file frmat like .mov etc. Then convert those uploaded files at runtime into .flv files and then play those flv files using flvpalyer. I need all this functionality.

So, can somebody pls help me.

Thanks,

View Replies !    View Related
FLVPlayer Problems
I have a training interface that I created. It's not perfect, and is constantly being upgraded, but that is besides the point.

In the interface, I have an FLVPlayback component. As one progresses through a course, this component displays different FLV's. I also have a Loader component that displays various SWF's.

My problem is this:

If the user clicks the "Next" button in quick succession, to skip forward to a later page, bypassing multiple video pages as they go, the videos load in order of call, play the audio for 1/2 second, and then go away, continuing until all of the videos have been loaded.

Is there a way that I can avoid this? Can I stop the load of a video?

If not, then I will have to do a minor/major rebuild, and create the instances of the FLVPlayback component in the script, deleting the references as I go. I am just trying to avoid that headache, and get a quick-fix out there before I do the rebuild.

AS2 btw.

View Replies !    View Related
StopPlay() On FLVPlayer
I have a page with multiple divs that are made visible/invisible by clicking on links. Some of the divs have FLV embedded in them using Dreamweaver. On IE7, the video doesn't stop playing when the div is made invisible. I have tried this. FLVPlayer is successfully found, but playback doesn't stop. Help, please!








Attach Code

function stopvideo() {
var isIE = navigator.appName.indexOf("Microsoft") != -1;
flashVideoPlayer = (isIE) ? window['FLVPlayer'] : document['FLVPlayer'];
if (isIE) {
flashVideoPlayer.StopPlay();
}
}



<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0','width','575','height','324','id','FLVPlayer','src','FLVPlayer_Progressive','flashvars','&MM_ComponentVersion=1&skinName=Corona_Skin_3&streamName=Sequence01&autoPlay=true&autoRewind=true','quality','high','scale','noscale','name','FLVPlayer','salign','lt','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','FLVPlayer_Progressive' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="575" height="324" id="FLVPlayer">
<param name="movie" value="FLVPlayer_Progressive.swf" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="salign" value="lt" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param name="FlashVars" value="&MM_ComponentVersion=1&skinName=Corona_Skin_3&streamName=Sequence01&autoPlay=true&autoRewind=true" />
<embed src="FLVPlayer_Progressive.swf" flashvars="&MM_ComponentVersion=1&skinName=Corona_Skin_3&streamName=Sequence01&autoPlay=true&autoRewind=true" quality="high" scale="noscale" width="575" height="324" name="FLVPlayer" salign="LT" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" />
</object></noscript>

View Replies !    View Related
FLVPlayer Alignment
Hi,

I'm faced with an annoyong problem. I am loading various flv's into my
flvPlayer component. This all works fine.

The problem arises when I want to align the video window to the centre
of the screen. The real problem is that each video is going to be of a
different size.

Can anyone think of a way to centre this movieclip each time the
content path is changed?

Thanks,

Dylan

View Replies !    View Related
Can A Seekbar Be Used Without A FLVPlayer?
Hi,

I am creating a flash video system that has multiple videos going at once. These videos are being loaded and played without using the flash FLVPlayback component. I am able to use many video functions like play and pause but I am not able to add a seekBar to my video. How can I use a seekBar component without using the FLVPlayback Component?

Thanks,

waffe

View Replies !    View Related
AS2 - Change Hue FLVPlayer
Hello there!

I did a website full-flash website with a feature that allow you to change the color of some elements (menu background, texte background...). The background of the site is a FLV video that I would change the HUE of it.

I googled to find my answer without any success. I was wondering if someone have a solution for this. I found something cool that is close to the solution http://www.quasimondo.com/archives/000615.php

My plan "B" is to put a movieClip on Top of the video (black & white) and put a blending option (hard light) and change dynamicly the tint of it. But I don't get the same effect.

I would ratter have a function that change the HUE of the Video. I already have a slider that give me a color hexec.

Thank you for helping me or giving me a clue.

Satiss

View Replies !    View Related
Get FLV-URL From Html Into The FlvPlayer
Hi i've been search internet all night now and i can't find an answer for this. So if anyone could help i'd be glad. I've made a flvplayer like the one in the tutorial here on gotoandlearn. But i want my FLV's to load from a URL written in the html-file and not from within the .swf/flvPlayer. Not very dynamical for a big page!

Code:

...Player">
  <param name="src" value="video/flvPlayer.swf" />
  <embed src="video/flvPlayer.swf[b]?videoURL=http://url.com/video.flv[/b]" pluginspa...

So if i write something like this then what should i write in the actionscript to get this to work.

Code:

...theVideo.attachVideo(ns);

ns.play("get the videoURL in here so it starts playing the file");

rewindButton.onRelease = function() {...

Hope you understand what i'm trying to get! Would be really really glad for help! Thanks!

View Replies !    View Related
Turn Memory Card In Memory Game
Are there still no way of rotating a bitmap in flash with descent result? A property that I dont know of..?!=)

View Replies !    View Related
Customizing FLVPlayer Controls
Hello, I am using the FLVPlayer control in Flash 8 to play videos. I would like to modify the behavior of the buttons on the player. Is there a simple way for me to re-assign the onRelease event?

Thanks
Jason

View Replies !    View Related
Scripting .swf For Flash 8 FLVPlayer
Hello Scripters:

I'm a newbie so please excuse me if this post is a little bit confusing or long I just want to try and be as clear as possible...

Ok my main objective is to post a flash .swf file to my (.php; wordpress) blog, using the new Flash 8 FLVPlayer skins.

I am creating a tutorial in Macromedia Captivate... I am able to either:

a.) publish to a .swf file (directly in Captivate);
b.) Export to Flash MX 2004 or;
c.) Import the Captivate Directly into Flash 8

Ok in my research, studies and tutorials, it seems that the FLV player is for .flv files (of course). I really like the look and feel of the ArcticExternalAll.swf skin.

How can I use one of the flash 8 skins with an .swf file?
Do I have to "script" the .swf file (instance) to work with the skin?
Is that even possible?
And is it even worth scripting (time-wise)? Because these would be short 2 minute video for a blog. It's not like a static page, meaning if I spend a lot of time scripting a static webpage it's going to be there for a very long time. I'm going to be posting short tutorials 3 times a week.

But my main question is it it even possible to use a new Flash 8 skin to play, pause, stop, rewind, mute etc. a .swf file.

Thanks >>B. Val<<

View Replies !    View Related
Preview Image For FLVPlayer
I have built a working FLVPlayer using the components provided by Flash CS3 and using ActionScript 3.0 to define the play/pause, etc. What I am having trouble with doing, due to the fact that I'm pretty much learning as I go, is getting a preview of the clip to show until the Play button is clicked. At which point, it will be removed to show the playing video that it was on top of.

I've experimented with many methods so far, all of which have failed. I read on here that you would want to insert the preview screen as a movie clip, which I have done. I tried the following which failed miserably, maybe someone can see what I'm doing wrong or possibly help me out with another method? Thanks!


Code:
var mc:MovieClip = parent.getChildByName("preview_screen") as MovieClip;

//Setup Play button to remove child
Play.btn.addEventListener(MouseEvent.MOUSE_DOWN, removePreview);
function removePreview(evt:MouseEvent):void
{
parent.removeChild(mc);
}
Mind you, in the removePreview function, I have also tried mc.removeChild(); and I tried parent.removeChild(mc); with the preview screen on a different layer other than the AS. I moved the preview screen to the same layer as the player and added the AS to Frame 1 of that same layer.

View Replies !    View Related
Multiple Flv Files In FLVPlayer
It seems you can only load one video into the flvplayer, is this true? I only waqnt about 3 videos, would it be easier just to use action script to navigate to another page identical to the first with another video loaded into the flvplayer?

Thanks

View Replies !    View Related
Make FLVPlayer Transparent
I'm hoping one or more of you may have done what I'm looking to accomplish.

I use the FLVPlayer (version 3.8) on our Web Site and would like to modify it to make it transparent. We are just starting to work with .flv's that have a transparent alpha channel and need that feature for design purposes. Basically the same effect that was seen in an Adobe Acrobat presentation a little over a year ago. We want to have an flv player that lets us have a clients talent appear to walk accros the Web Page and deliver a short video message. A transparent player is key to the project.

I read that if I removed the "back" from the FLVPlayers .fla file I would get what I'm looking for but sadly it is still not transparent.

Any suggestions will certainly be appreciated. If you've done this before can you give me a push in the right direction. It's my first attempt at using CS3.





























Edited: 05/19/2007 at 09:40:49 AM by JimIdaho

View Replies !    View Related
Key Stroke To FLVplayer Buttons
I've made some FLV Playback Custom UI buttons, wich I would like to add a keyboard shortcut to.
How do I do that?
I want my flv to pause when you hit P on the keyboard and start when you hit S...
I've tried som different key stroke methods but with no succes.
Hope you can help me!

View Replies !    View Related
FLVPlayer.playheadTime Not Working
I'm trying to show elapsed time / total time. I've viewed other topics that cover this, and I seem to be matching their code, but I must be missing something because my playheadTime never changes from 0. Here is my code:

import fl.video.*;
import flash.utils.Timer;
import flash.events.TimerEvent;

var flvTimer:Timer = new Timer(1000);

movie_player.addEventListener(MetadataEvent.METADATA_RECEIVED, md);
flvTimer.addEventListener(TimerEvent.TIMER, jump);

function md(ev:MetadataEvent):void {
var allTime:Number = ev.info.duration;
var totalMinutes:Number = Math.round(allTime/60);
var totalSeconds:Number = Math.round(allTime - (totalMinutes*60));
var totalFormatted:String = String(totalMinutes) + ":" + String(totalSeconds);
totalTime_txt.text = totalFormatted;
}

function jump(event:TimerEvent):void {
var currentTime:Number = Math.round(this.movie_player.playheadTime / 1000)
var sCurrentTime:String = String(currentTime)
time_txt.text = sCurrentTime;
trace("Timer jump function hit and playheadTime = " + sCurrentTime);
}

flvTimer.start();

movie_player is an instance of the FLVPlayer component that is found on the stage of the main timeline. The code is hard-coded on the actions panel of the same frame as the player instance. I don't know if I am not importing something I should be or what. Any help would be greatly appreciated.







Attach Code

import fl.video.*;
import flash.utils.Timer;
import flash.events.TimerEvent;

var flvTimer:Timer = new Timer(1000);

movie_player.addEventListener(MetadataEvent.METADATA_RECEIVED, md);
flvTimer.addEventListener(TimerEvent.TIMER, jump);

function md(ev:MetadataEvent):void {
var allTime:Number = ev.info.duration;
var totalMinutes:Number = Math.round(allTime/60);
var totalSeconds:Number = Math.round(allTime - (totalMinutes*60));
var totalFormatted:String = String(totalMinutes) + ":" + String(totalSeconds);
totalTime_txt.text = totalFormatted;
}

function jump(event:TimerEvent):void {
var currentTime:Number = Math.round(this.movie_player.playheadTime / 1000)
var sCurrentTime:String = String(currentTime)
time_txt.text = sCurrentTime;
trace("Timer jump function hit and playheadTime = " + sCurrentTime);
}

flvTimer.start();

View Replies !    View Related
Help Passing A Variable To FLVPlayer
I am working on a little gallery to play FLV clips. I have gotten the following working:

Frame 1 (labeled list) has a list of the videos with thumbnails that have the following variables assigned for onPress:
videoPath = "path/to/video.flv";
returnTo = "list";
gotoAndPlay("player");

Frame 10 (labeled player) has an embedded FLVPlayer Component which grabs the videoPath and plays the video referenced.

Now I am working with a scrolling component I found online so I can have a longer list of videos in Frame 1 but the long list is inside its own movieclip.

So I have made the variables global:

_global.videoPath = "path/to/video.flv";
_global.returnTo = "list";
_root.gotoAndPlay("player");

and it still works except it wont play the video.

I have the following on the FLVPlayer component frame:
// Begin playing the FLV file
videoplayer.play(_global.videoPath);

where videoplayer is the instancename of the FLVComponent.

Any ideas why it's not working? I'm a bit of a newb at actionscript so if you need more info let me know.

Thanks,
Jon

View Replies !    View Related
Using Button To Unload FLVPlayer
I am working in Fash CS3 in Action Sript 3

I have an flvplayer set to autoplay on a layer. I set a button to go to the keyframe where the FLVPlayer is. When Flash goes to that point on the timeline, the FlVPlayer loads up fine and the video plays.

The problem is when you want to stop the movie in midstream try to go to the home page it continues to play the audio.

I am trying to enable Flash to stop the video at any time by using a button and mouseEvent. Upon click I want the video to stop playing then move to another spot on the timeline,(in this case the keyframe that holds my home page).

My problem is I cannot figure out how to set up the code to unload the video when an on CLICK mouse event is set to my home button.

I understand how variables, functions, and mouse events work, I just can't figure out how to set it up.

Any help would be appreciated.

View Replies !    View Related
Few Questions Bout Lee's FLVPlayer And Req. For An [AS1] Pla
Wow..a bit ago since i've posted something!

I just followed the Basic Video Tutorial and have some questions.
Unfortunately i didn't find a solution in using the search option. (Or maybe i tried the wrong words)

1. I want to put an autoRewind to the Player. Can someone tell me how and where?
2. After the FLV is finished, the Buffering Display appears and doesn't stop. Anyone know about this?

EDIT: I just found Todds AS for this:
http://www.ludvigjernqvist.se/forum/viewtopic.php?f=10&t=3941&p=17787&hilit=flv#p17787
Problems solved...thanks Todd!
So only No.3 left.

3. Okay a different request. Today i've searched the Internet for hours to find an custom FLV-Player that works with AS1. Does anyone know where to find one?

Much thanks in advance and sorry for my bloody english
Jiggy

View Replies !    View Related
For Actionscript Guru FLVPlayer Need Buffer
Hi,

I´m using a FLVPlayer from..www.jeroenwijering.com

I need to make a video buffer and a movieclip that shows " Loading..."
I made a buffer video, and the carrega_mc that is "Loading.." but is not working...

This is the my changed code from www.jeroenwijering.com :
code:

//--------------------------------------------------------------------------
// initial variables that might be useful to change
//--------------------------------------------------------------------------
// toggle for which file to play if none was set in html
// you can change the 'test.flv' in your filename
!_root.file ? file="videos/aes-hi.flv" : file=_root.file;
// toggle for autostarting the video
// you can change the 'true' in 'false'
!_root.autoStart ? autoStart=false : autoStart=_root.autoStart;
// toggle for the width and height of the video
// you can change them to the width and height you want
w = Stage.width;
h = Stage.height;
//--------------------------------------------------------------------------
// stream setup and functions
//--------------------------------------------------------------------------
// create and set netstream
nc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
ns.setBufferTime(10);
nc.setBufferTime(10);
// create and set sound object
this.createEmptyMovieClip("snd", 0);
snd.attachAudio(ns);
audio = new Sound(snd);
audio.setVolume(80);
//attach videodisplay
videoDisplay.attachVideo(ns);
// Retrieve duration meta data from netstream
ns.onMetaData = function(obj) {
this.totalTime = obj.duration;
// these three lines were used for automatically sizing
// it is now done by sizing the video to stage dimensions
// if(obj.height > 0 && obj.height < Stage.height-20) {
// setDims(obj.width, obj.height);
// }
};
// retrieve status messages from netstream
ns.onStatus = function(object) {
if (object.code == "NetStream.Play.Stop") {
// rewind and pause on when movie is finished
ns.seek(0);
ns.pause();
playBut._visible = true;
pauseBut._visible = false;
videoDisplay._visible = false;
//playText.txt.text = "click to play";
playText.text = "click para iniciar";
}
};
//--------------------------------------------------------------------------
// controlbar functionality
//--------------------------------------------------------------------------
// play the movie and hide playbutton
function playMovie() {
if (!isStarted) {
//nc.setBufferTime(10);
//carrega.text = "Carregando ..";
carrega_mc._visible = true;
ns.play(file);
//playText.txt.text = "loading ..";
//carrega_mc._visible = true;
playText.text = " ";
isStarted = true;
} else {
ns.pause();
carrega_mc._visible = true;
}
pauseBut._visible = true;
playBut._visible = false;
videoDisplay._visible = true;
}
// pause the movie and hide pausebutton
function pauseMovie() {
ns.pause();
playBut._visible = true;
pauseBut._visible = false;
}
// video click action
videoBg.onPress = function() {
if (pauseBut._visible == false) {
carrega_mc._visible = true;
nc.setBufferTime(10);
//carrega.text = "Carregando ..";
playMovie();
//carrega_mc._visible = false;
playText.text._visible = false;
} else {
pauseMovie();
}
};
// pause button action
pauseBut.onPress = function() {
pauseMovie();
};
// play button action
playBut.onPress = function() {
carrega_mc._visible = true;
nc.setBufferTime(10);
//carrega.text = "Carregando ..";

playMovie();
//carrega_mc._visible = false;
playText.text._visible = false;
};
// file load progress
progressBar.onEnterFrame = function() {
loaded = this._parent.ns.bytesLoaded;
total = this._parent.ns.bytesTotal;
if (loaded == total && loaded>1000) {
this.loa._xscale = 100;
delete this.onEnterFrame;
} else {
this.loa._xscale = int(loaded/total*100);
}
};
// play progress function
progressBar.tme.onEnterFrame = function() {
this._xscale = ns.time/ns.totalTime*100;
};
// start playhead scrubbing
progressBar.loa.onPress = function() {
this.onEnterFrame = function() {
scl = (this._xmouse/this._width)*(this._xscale/100)*(this._xscale/100);
if (scl<0.02) {
scl = 0;
}
ns.seek(scl*ns.totalTime);
};
};
// stop playhead scrubbing
progressBar.loa.onRelease = progressBar.loa.onReleaseOutside=function () {
delete this.onEnterFrame;
pauseBut._visible == false ? videoDisplay.pause() : null;
};
// volume scrubbing
volumeBar.back.onPress = function() {
this.onEnterFrame = function() {
var xm = this._xmouse;
if (xm>=0 && xm<=20) {
this._parent.mask._width = this._xmouse;
this._parent._parent.audio.setVolume(this._xmouse* 5);
}
};
};
volumeBar.back.onRelease = volumeBar.back.onReleaseOutside=function () {
delete this.onEnterFrame;
};
//--------------------------------------------------------------------------
// resize and position all items
//--------------------------------------------------------------------------
function setDims(w, h) {
// set videodisplay dimensions
videoDisplay._width = videoBg._width=w;
videoDisplay._height = videoBg._height=h-20;
playText._x = w/2-120;
playText._y = h/2-20;
// resize the items on the left ..
playBut._y = pauseBut._y=progressBar._y=volumeBar._y=h-20;
progressBar._width = w-56;
volumeBar._x = w-38;
}
// here you can ovverride the dimensions of the video
setDims(w, h);
setDims(320, 213);
//--------------------------------------------------------------------------
// all done ? start the movie !
//--------------------------------------------------------------------------
// start playing the movie
// if no autoStart it searches for a placeholder jpg
// and hides the pauseBut
if (autoStart == true) {
carrega_mc._visible = true;
nc.setBufferTime(10);
playMovie();
//carrega_mc._visible = false;
playText.text._visible = false;
} else {
pauseBut._visible = false;
//imageStr = substring(file,0,file.length-3)+"jpg";
//imageClip.loadMovie(imageStr);
}

View Replies !    View Related
FLVPlayer Sound/stop Issue
Hey guys,
I've got an FLVPlayer on scene 1 & would like it to stop playing (mainly the sound) when you go to scene 2, 3, etc.
I've tried stopAllSound - etc. but all i get with those is errors.
How do you stop the player?

Thanks

View Replies !    View Related
Playing Multiple Movies In The Same FLVPlayer
I have two buttons that I want people to be able to choose from and play in the FLVPlayer but it will not play. Here is what I have done so far:

1) I've created two buttons with the "control with actionscript" checked off and assigned the same button names to the instance name.
spinachVideo_btn
tourVideo_btn

2)I gave the FLVPlayback instance the name "moviePlayer" and assigned the following the script to the timeline:

stop();
spinachVideo_Btn.onRelease = function (){
moviePlayer.contentPath = "spinachVideo.flv";
}
tourVideo_Btn.onRelease = function (){
moviePlayer.contentPath = "tourVideo.flv";
}

3)The FLVPlayer default for the content path is: contentPath = "tourVideo.flv"

Where did I go wrong? Again, anyone's help is greatly appreciated.

View Replies !    View Related
Create My Own Component - How To Do Like FLVPlayer 8 Skin
I have create a component.
The problem was always the same, component v2 was hard to customize. Well that is my opinion. With Flash 8 a new way to customize has been created. If you look at the FLVPlayback, to customize the player you can go to a Fla and do what you want, publish it, and then you load it as a skin.

Is there a tutorial or something that can show me how to do that with my own component

Tanx !

View Replies !    View Related
[BUG?] FLVPlayer Doesn't Work On Fullscreen Swf
if anyone is using Flash CS3, try creating a flash movie, using the FLVPlayer component to play an flv video and make it an executable projector. Run it fullscreen and watch how the screen just stays black when the video should appear. If you stay windowed, it works fine.

steps to reproduce:
1. create flash movie (on CS3, for Flash Player 9 with AS3)
2. put an FLVPlayer component on a frame that's not the first (for testing purposes)
3. before the projector reaches the frame with the FLVPlayer component, change it to fullscreen (by script or CTRL+F)

observed behaviour:
not only the video doesn't play, but the whole screen is black until the player goes back to windowed mode

expected behaviour:
video should play

remarks:
if you skip step 3, video plays correctly





























Edited: 05/17/2007 at 11:57:02 PM by Lt.CYX[UGA]

View Replies !    View Related
FLVPlayer Dies When ContentPath Changed
I've written a player application which happily streams from FMS2 using an FLVPlayer component.

However, when the time comes to display a new video, and I set the contentPath property, the player changes state to "connectionError" and pretty much refuses to do anything after that. Dead.

Any ideas on what I might be doing wrong or how to work around it?

View Replies !    View Related
Need To Rewrite Pre-loader For FLVplayer In A Projector
I have a working pre-loader in AS2 that counts up the bytes when loading an flv into a plain video object. But now I need to use the FLVplayback component instead, and need to do it in an AS3 projector...and I'm stuck. AS3 and the FLVplayback both make this unnecessarily complicated, and I've wasted many hours searching the documentation and too many forums to count, all sending me down blind alleys.

Any suggestions? Below is the code that works for AS2 and video. The video object is called my_video, the dynamic text box is called progressMessage, and the progress bar is oddly called progressBar.

And is there much difference between doing this in a projector, rather than in a browser?







Attach Code

var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);

var loadInterval:Number;

// create the stream
var my_ns:NetStream = new NetStream(connection_nc);

function checkBytesLoaded(flvLocation:String){
var myVideo:Video = my_video;
var myNetstream:NetStream = my_ns;
var theMovie:String = flvLocation;
var pctLoaded:Number = Math.round(myNetstream.bytesLoaded / myNetstream.bytesTotal * 100);
progressMessage.text = pctLoaded + " %";

// update progress bar on the stage
progressBar._xscale = pctLoaded;

if (pctLoaded>=100){

// kill interval
clearInterval(loadInterval);

// un-toggle the pause, so the movie plays
my_ns.pause();

// hide the message and progress bar
progressMessage._visible = false;
progressBar._visible = false;
barOutside._visible = false;
}
}

// load the flv
function loadFLV(flvLocation:String):Void{
var myVideo:Video = my_video;
var myNetstream:NetStream = my_ns;
var theMovie:String = flvLocation;
myVideo.attachVideo(myNetstream);
myNetstream.play(theMovie);

// don't start playing yet
myNetstream.pause();

// check loading progress
loadInterval = setInterval(this, "checkBytesLoaded", 100, flvLocation);
}

// preload movie
loadFLV("movie.flv");

View Replies !    View Related
Why Doesn't My Flvplayer Pause With A Class?
ActionScript Code:
class FlvPlayer {    public var videoURL:String;    public var theVideo:MovieClip;    public var nc:NetConnection;    public var ns:NetStream;    function FlvPlayer() {        nc = new NetConnection();        nc.connect(null);        ns  = new NetStream(nc);            }    function playVideo():Void {        theVideo.attachVideo(ns);        ns.play(videoURL);    }    function rewindVideo():Void {        trace("rewind");        ns.seek(0);    }    function pauseVideo():Void {        trace("pause");        ns.pause();    }}

and with


ActionScript Code:
import FlvPlayer.as;var flvplayer:FlvPlayer = new FlvPlayer();flvplayer.theVideo = theVideoSkin;flvplayer.videoURL = "test.flv";flvplayer.playVideo();rewindBtn.onRelease = flvplayer.rewindVideo;pauseBtn.onRelease = flvplayer.pauseVideo;


Now it does play but it doesn't rewind or pause but i do see the corresponding tracing messages???

Any idea

View Replies !    View Related
FLVplayer Menu Alpha Fade
Hi i i'm a beginner when it comes to Flash, but i have managed to follow all the video tutorials.

Now my question is what is the easiest way to fade up the whole menu while hovering the video. And then fade it back out when the mousepointer is out again.

One more question how do i load the movie by FlashVars from the html?

The flashfile is build exactly as the tutorials.

Jake

View Replies !    View Related
Get A Movie TITLE From Html Into The FlvPlayer
Hello,

I've got a question related to this topic: http://www.gotoandlearn.com/forum/viewtopic.php?t=8910


Has anyone a solution for the following?:

Besides adding the URL location in the HTML code of the flv file I was wondering if it is also possible to add an video TITLE. I think it has got something to do wit a dynamic textfield. But does anyone has an example code? I've already tried multiple times. But as a flash starter I'm having some problems to get it working

I've looked around, but could not find a useful tutorial or tip.

BTW; the URL in HTML is working great!

Thanks in advance!

View Replies !    View Related
Control Flvplayer Video Source With Actionscript
the solution i am currently using is I added a new video then use the following code to control the source. I was wondering how I can do the same thing but to the flvplayer built into flash 8



Code:
stop();
// create a netConnection object
var nc:NetConnection = new NetConnection();
// connect to null
nc.connect(null);
// create netStream object
// and pass the netConnect to it
var ns:NetStream = new NetStream(nc);
// attach the netStream object to the embedded video object
myVideo.attachVideo(ns);
// netSTream object plays the video
ns.play(video);

View Replies !    View Related
Trying To Remotely Control A Hosted Bliptv Flvplayer...
http://blip.tv/scripts/flash/blippla...atFozzy370.flv

I'm loading up a flvplayer.swf (as the above) on a level (the player is full of _root references and I obviously don't have access to it...) in one of my own Flash movie, and trying to control it, from my own movie...

First question...

Can someone explain to me why while testing this locally (although the file won't actually play because of a Security Sandbox Violation...), I can trace most of it's variables or somewhat control it's appearance, but that I get undefined on variables and/or can't control it's appearance, when my movie is uploaded to a server, although it now plays fine?

View Replies !    View Related
SwapDepth - FLVPlayer Component And Custom Skin
How would I do a "swap depth" for actionscript3?

I am trying to reskin and customize the FLVPlayer component in Flash CS3 (AS3). I am calling the component and creating settings via actionscript (not by dragging the component to the stage) and I would like artwork to appear both above and below the component, and the custom player components and buttons to appear above the video. Right now, the stacking order is such that the player appears on top of everything, even UI elements, and even on top of artwork that is on a layer above the layer with the AS that calls the FLVPlayer.

How can I properly set the stacking order? I know I can't do swapdepth with AS3.

This is the code I currently have:


Code:
import com.liquidprint.video.FLVPlaybackPro;

var fpp:FLVPlaybackPro = new FLVPlaybackPro();

fpp.x = 103.5;
fpp.y = 22;
fpp.playPauseButton = myplayBtn;
fpp.seekBar = myseekBar;
fpp.height = 400;
fpp.width = 533;
fpp.source = "http://www.liquidprint.com/services/liquidprintvideo.flv";
fpp.autoPlay = true;

addChild(fpp);

View Replies !    View Related
Dynamically Change Content Path Of FLVPlayer
I've added a drop down list and would like the content path of the FLVplayer to reflect this change. So far I have :

var myListener:Object = new Object();
ddlVideos.addEventListener("change",myListener);

myListener.change = function(){
//gotoAndStop(ddlVideos.value);
player.stop();
player.contentPath = "media/ACC-" + ddlVideos.value + ".flv";
player.play();

}
I tried the gotoAndStop and that works fine. I traced the string that's going into the contentPath and it's correct, however the player isn't being updated. any ideas?

View Replies !    View Related
CS3/AS2 Need To Add A Function To FLVPlayer Component Play Button
Hi,
I have an instance of the FLVPlayback component in a movie.
I need to assign an extra function to the play button in the component
(to tell another swf on the same page to stop, I have the function working)
how can I find out the button instance name so I can assign the function to it?

or am I on the wrong track?
mark

View Replies !    View Related
Movie Clips On Stage Bogging Down FlvPlayer
I have a video that was shot at a sales conference that I have made into an flv and am playing in an AS3 flvPlayer at 720 X 480. There are about 50 slides that the presenter used that were recorded in the video stream, but are of too low quality to really see.

I brought the slides into the library and made them into movie clips. I placed the movie clips into layers and set up AS3 to either set their alpha to 0 or 1 by referencing AS cuepoints. At those cuepoints the movie clips are displayed on top of the video.

The problem I have encountered is that it works fine until I put between 20 and 25 movie clips on the stage and then it bogs down the flvPlayer to the point that it is unusuable.

Why it works fine at 20 but not at 50, I don't know.

Attached is a sample of the code I am using.

Any suggestions?







Attach Code

//Template with Blanks
import fl.video.VideoEvent;
import flash.display.Sprite;
import fl.video.FLVPlayback;
import fl.video.MetadataEvent;
import fl.video.CuePointType;
import flash.events.MouseEvent;
import flash.net.navigateToURL;
import flash.net.URLRequest;
import flash.net.URLVariables;

//********** Modify below to match number of slides to be shown - including blanks **********
var numberofSlides:Number = 13; // Total number of slides

//********** Modify below to set how many seconds each forward or back button jumps **********
var Jump:Number = 10; // Number of seconds to jump when a jump button is clicked

var slideTime:Array = new Array(); // Create an array to hold the slide start times

//********** Modify below to match numbers of blank slides **********
var blankSlide:Array = new Array(2,4,13); // Create an array to hold the blank slide numbers

//********** Modify below to set times for slides to be shown **********
// This example shows 10 real slides (ones with pictures) and 3 blank spots
// Slide start times
slideTime[1] = 0; // first real slide
slideTime[2] = 10; // blank
slideTime[3] = 15; // second real slide
slideTime[4] = 25; // blank
slideTime[5] = 30; // 3rd real slide
slideTime[6] = 45; // 4th real slide
slideTime[7] = 60;
slideTime[8] = 75;
slideTime[9] = 90;
slideTime[10] = 105;
slideTime[11] = 120;
slideTime[12] = 135; // 10th real slide
slideTime[13] = 145; // blank
/*
slideTime[14] = 0;
slideTime[15] = 0;
slideTime[16] = 0;
slideTime[17] = 0;
slideTime[18] = 0;
slideTime[19] = 0;
slideTime[20] = 0;
*/

var topicTime:Array = new Array(); // Create an array to hold the navigation seek times

//********** Modify below to set times for topics to be selected **********
// Topic navigation seek times
topicTime[1] = 0; // at slide 1
topicTime[2] = 30; // at slide 3
topicTime[3] = 60; // at slide 5
topicTime[4] = 90; // at slide 7
topicTime[5] = 120; // at slide 9
/*
topicTime[6] = 20;
topicTime[7] = 20;
topicTime[8] = 20;
topicTime[9] = 20;
topicTime[10] = 20;
topicTime[11] = 20;
topicTime[12] = 20;
*/

var fp:FLVPlayback;// An internal reference for the FLVPlayback instance
var slideNumber:Number = 1; // Slide currently being displayed
fp = this.getChildByName("flvPlayer") as FLVPlayback;// Make a reference to the FLVPlayback instance on the stage
//fp.autoRewind = true; // Set player to rewind when end of FLV is reached
fp.addEventListener(MetadataEvent.CUE_POINT, onCueEvent);// Pass cue point events to the onCueEvent function
fp.addEventListener(VideoEvent.SCRUB_START, onScrubStartEvent); // Listen for scrub start
fp.addEventListener(VideoEvent.SCRUB_FINISH, onScrubFinishEvent); // Listen for scrub finish
fp.addEventListener(VideoEvent.SEEKED, onSeekedEvent); // Listen for seeked event
fp.addEventListener(VideoEvent.COMPLETE, onVideoCompleteEvent); // Rewind FLV after end is reached

//An event listener is required for each button
Forward_btn.addEventListener(MouseEvent.CLICK, buttonForward_btn);
Back_btn.addEventListener(MouseEvent.CLICK, buttonBack_btn);

//********** Modify below to set listeners for topics to be selected **********
Topic1_btn.addEventListener(MouseEvent.CLICK, buttonTopic1_btn);
Topic2_btn.addEventListener(MouseEvent.CLICK, buttonTopic2_btn);
Topic3_btn.addEventListener(MouseEvent.CLICK, buttonTopic3_btn);
Topic4_btn.addEventListener(MouseEvent.CLICK, buttonTopic4_btn);
Topic5_btn.addEventListener(MouseEvent.CLICK, buttonTopic5_btn);
/*
Topic6_btn.addEventListener(MouseEvent.CLICK, buttonTopic6_btn);
Topic7_btn.addEventListener(MouseEvent.CLICK, buttonTopic7_btn);
Topic8_btn.addEventListener(MouseEvent.CLICK, buttonTopic8_btn);
Topic9_btn.addEventListener(MouseEvent.CLICK, buttonTopic9_btn);
Topic10_btn.addEventListener(MouseEvent.CLICK, buttonTopic10_btn);
Topic11_btn.addEventListener(MouseEvent.CLICK, buttonTopic11_btn);
Topic12_btn.addEventListener(MouseEvent.CLICK, buttonTopic12_btn);

/*The next line is if you wanted to have a download button
Download_btn.addEventListener(MouseEvent.CLICK,DownloadPDF);
*/

// Build cue points list
var slideName:String;
for ( var n:Number = 1; n <= numberofSlides; n++ )
{
slideName = "Slide" + (n);
fp.addASCuePoint(slideTime[n], slideName);
}

// Set all slide clips to 0
function ZeroClips():void
{
var clipName;
for( var n:Number = 1; n <= numberofSlides; n++ )
{
var i:Number = 0;
var blank:Boolean = false;

for( i; blankSlide[i]; i++ ) // Do not zero blank spots
if ( blankSlide[i] == n )
{
blank = true;
break;
}

if ( blank )
continue;

clipName = getChildByName("Slide" + n + "_mc");
clipName.alpha = 0;
}
}

// Pause flv before scrubbing
function onScrubStartEvent(e:VideoEvent):void
{
fp.pause();
}

// Show slide to match seek or scrub positon
function onSeekOrScrub():void
{
for( var n:Number = 1; n <= numberofSlides; n++ )
{
var clipName;
var i:Number = 0;
if ( slideNumber != n )
{
if ( fp.playheadTime < slideTime[numberofSlides]
&& fp.playheadTime > slideTime[n]
&& fp.playheadTime < slideTime[n + 1] )
{
ZeroClips();
slideNumber = n;
for( i; blankSlide[i]; i++ )
{
if ( blankSlide[i] == n )
{
fp.play();
return;
}
}

clipName = getChildByName("Slide" + n + "_mc");
clipName.alpha = 1;
break;
}

if ( fp.playheadTime > slideTime[numberofSlides] )
{
ZeroClips();
slideNumber = numberofSlides;
for( i; blankSlide[i]; i++ )
{
if ( blankSlide[i] == numberofSlides )
{
fp.play();
return;
}
}

clipName = getChildByName("Slide" + numberofSlides + "_mc");
clipName.alpha = 1;
break;
}
}
}
fp.play();
}

// Handle scrub event - user scrubbed
function onScrubFinishEvent(e:VideoEvent):void
{
onSeekOrScrub();
}

// Handle seek event - user clicked seek bar
function onSeekedEvent(e:VideoEvent):void
{
onSeekOrScrub();
}

// Not sure we will ever need to do anything when FLV has ended but put this in for just in case
// Currently does nothing
function onVideoCompleteEvent(e:VideoEvent):void
{

}

function onCueEvent(e:MetadataEvent):void
{
// Create a reference to the fired cue point
var cue:Object = e.info;
/*
trace("Cue point reached >");
trace(" cue.type: " + cue.type);
trace(" cue.name: " + cue.name);
trace(" cue.time: " + cue.time);
trace("
");
*/

// If the cue point is an actionscript cue point
// Just ignore any other types that might be present
if(cue.type == CuePointType.ACTIONSCRIPT)
{
ZeroClips();

slideNumber++;

switch (cue.name)
{
//********** Modify below to match number of slides to be shown **********
case "Slide1":
Slide1_mc.alpha = 1;
break;
case "Slide2":
//Slide2_mc.alpha = 1; // Do not set blank spots
break;
case "Slide3":
Slide3_mc.alpha = 1;
break;
case "Slide4":
//Slide4_mc.alpha = 1;
break;
case "Slide5":
Slide5_mc.alpha = 1;
break;
case "Slide6":
Slide6_mc.alpha = 1;
break;
case "Slide7":
Slide7_mc.alpha = 1;
break;
case "Slide8":
Slide8_mc.alpha = 1;
break;
case "Slide9":
Slide9_mc.alpha = 1;
break;
case "Slide10":
Slide10_mc.alpha = 1;
break;
case "Slide11":
Slide11_mc.alpha = 1;
break;
case "Slide12":
Slide12_mc.alpha = 1;
break;
case "Slide13":
//Slide13_mc.alpha = 1;
break;
/*
case "Slide14":
Slide14_mc.alpha = 1;
break;
case "Slide15":
Slide15_mc.alpha = 1;
break;
case "Slide16":
Slide16_mc.alpha = 1;
break;
case "Slide17":
Slide17_mc.alpha = 1;
break;
case "Slide18":
Slide18_mc.alpha = 1;
break;
case "Slide19":
Slide19_mc.alpha = 1;
break;
case "Slide20":
Slide21_mc.alpha = 1;
break;
*/
}
}
}

//********** Modify below to set buttons for topics to be selected **********
// Navigation event handling
function buttonTopic1_btn(e:MouseEvent)
{
fp.pause();
fp.seek(topicTime[1]);
fp.play();
}

function buttonTopic2_btn(e:MouseEvent)
{
fp.pause();
fp.seek(topicTime[2]);
fp.play();
}

function buttonTopic3_btn(e:MouseEvent)
{
fp.pause();
fp.seek(topicTime[3]);
fp.play();
}

function buttonTopic4_btn(e:MouseEvent)
{
fp.pause();
fp.seek(topicTime[4]);
fp.play();
}

function buttonTopic5_btn(e:MouseEvent)
{
fp.pause();
fp.seek(topicTime[5]);
fp.play();
}
/*
function buttonTopic6_btn(e:MouseEvent)
{
fp.pause();
fp.seek(topicTime[6]);
fp.play();
}

function buttonTopic7_btn(e:MouseEvent)
{
fp.pause();
fp.seek(topicTime[7]);
fp.play();
}

function buttonTopic8_btn(e:MouseEvent)
{
fp.pause();
fp.seek(topicTime[8]);
fp.play();
}

function buttonTopic9_btn(e:MouseEvent)
{
fp.pause();
fp.seek(topicTime[9]);
fp.play();
}

function buttonTopic10_btn(e:MouseEvent)
{
fp.pause();
fp.seek(topicTime[10]);
fp.play();
}

function buttonTopic11_btn(e:MouseEvent)
{
fp.pause();
fp.seek(topicTime[11]);
fp.play();
}

function buttonTopic12_btn(e:MouseEvent)
{
fp.pause();
fp.seek(topicTime[12]);
fp.play();
}
*/

function buttonForward_btn(e:MouseEvent)
{
fp.pause();
fp.seek(fp.playheadTime + Jump);
fp.play();
}

function buttonBack_btn(e:MouseEvent)
{
fp.pause();
if ( fp.playheadTime - Jump > 0 )
fp.seek(fp.playheadTime - Jump);
else
fp.seek(0);

fp.play();
}

/*
function DownloadPDF(e:MouseEvent)
{
var url:String = "http://intranet.securecomputing.com/departments/sales_training/Resources/NetItOutWorkbook.pdf";
var request:URLRequest = new URLRequest(url);
navigateToURL(request);
}
*/

ZeroClips();
Slide1_mc.alpha = 1;
stop();

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved