Adobe Dreamweaver Forums



Last 10 THreads :         problems linking PDFs (Last Post : Alan - Replies : 1 - Views : 2 )           »          Changing RadioButton Label (Last Post : justintoflex - Replies : 2 - Views : 5 )           »          Table Borders MIssing in JavaHelp (Last Post : soxmann - Replies : 3 - Views : 8 )           »          Clock .getUTC not working (Last Post : bolszo - Replies : 2 - Views : 3 )           »          cfimage error (Last Post : masoud_amen - Replies : 2 - Views : 3 )           »          Dragging components (Last Post : hsfrey - Replies : 2 - Views : 4 )           »          Is file too large? (Last Post : tweaked_eye - Replies : 0 - Views : 1 )           »          Could not find the included template (Last Post : azuro28 - Replies : 2 - Views : 3 )           »          flash loader reappears after movie plays (Last Post : lyshamo - Replies : 3 - Views : 4 )           »          How to turn IMAGE into MOVIECLIP??? (Last Post : Snufferson - Replies : 7 - Views : 8 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 12-01-2008, 06:35 PM
stephan1403
 
Posts: n/a
Diggs:
Default swf counter

hi everybody,

folling problem. I have a swf video which I need to count how often it was
played till the end.

I thought I can wrap it in another swf and add an eventlistener to recognize
the last frame.
this is my code:

[Q]<?xml version="1.0" encoding="utf-8"?> <mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="init()"> <mx:Script> <![CDATA[ import
flash.events.*; import flash.display.MovieClip; public var
myMC:MovieClip; public function init():void{
label1.text = "init1";
loadTheSWF.addEventListener(Event.INIT,initHandler ); }
private function initHandler(event:Event):void{ label1.text =
"init2"; //trace("init"); try{
myMC = MovieClip(loadTheSWF.content);
myMC.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler); }
catch(error:Error){ trace("Error, error="+error);
} } private function
onEnterFrameHandler(event:Event):void{
if(event.currentTarget.currentFrame == event.currentTarget.totalFrames){
label1.text = "complete";
myMC.removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
trace("movie palyed"); } } ]]> </mx:Script>
<mx:Panel id="swfPanel" horizontalAlign="center"
verticalAlign="center"> <mx:Label id="label1" text="video1"/>
<mx:SWFLoader id="loadTheSWF"
source="@Embed(source='video1.swf')" height="495"
width="640" scaleContent="true"/> </mx:Panel> </mx:Application>[/Q]

It goes into init() function but the added eventlistener is not working.
does anybody know what my mistake is or is there maybe another/better way to
do what I want to do?

thx in advance



Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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

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



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 11:54 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk