Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

coverflow video

This is a discussion on coverflow video within the FLEX builder 3 forums, part of the Flash CS3 e Actionscript 3.0 category; innanzi tutto un saluto a tutti i frequentatori di questo bell'ambiente, ed i complimenti a chi lo gestisce fornendo ...


Go Back   Forum Flash CS3 Flash CS4 > Flash CS3 e Actionscript 3.0 > FLEX builder 3

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-07-08, 18:04
Member
 
Join Date: Jul 2008
Posts: 30
Rep Power: 0
dadoge is on a distinguished road
coverflow video

innanzi tutto un saluto a tutti i frequentatori di questo bell'ambiente, ed i complimenti a chi lo gestisce fornendo spunti ed esempi assai interessanti...

veniamo al dunque...premetto che sono alle prime armi con actionscript ed ancorpiù con flex che ho aperto solo per cercare di sviluppare un esempio trovato su

http://flash.html.it/articoli/leggi/2633/coverflow/10/

ovvero un cowerflow video assai intricante...ho seguito l'esempio e con un po' di fatica sono riuscito a renderlo funzionante, l'esempio sul link non funziona ma potete visionare il mio:

http://www.avantgardesrl.tv/prova/video/mytube.html

nella versione originale c'è un piccolo problema, avviando più video rimangono tutti inesecuzione con ovvi problemi di gestione e fruizione, io ho tentato di rimediare inserendo una funzione su Roll-out che chiude il filmato appena il muose ne esce (nel listato la funzione chiudi)...diciamo che risolve la cosa ma non elegantemente...l'ideale sarebbe che nel momento in cui si avvia il secondo filmato venga chiuso quello in esecuzione...per quanto mi ci sono sbattuto non ho trovato soluzione...qualcuno potrebbe suggerirmi l'idea giusta?

Altra cosa...è normale che spesso e volentieri flex mi si chiuda da solo con una finestra di errore?


Allego il codice di gestione

Mille ringraziamenti...e continuerò a frequentare il forum con grande interesse...


package
{
import flash.events.Event;
import flash.events.MouseEvent;

import mx.containers.Canvas;
import mx.controls.Button;
import mx.controls.Image;
import mx.controls.VideoDisplay;
import mx.events.FlexEvent;

publicclass MyVideo extends Canvas
{
privatevar thumb:Image;
privatevar video:VideoDisplay;
privatevar btn:Button;

privatevar isPlaying:Boolean = false;
privatevar thumbnail:String;
privatevar flv:String;

publicfunction MyVideo(thumbnail:String,flv:String)
{
this.thumbnail = thumbnail;
this.flv = flv;

this.width = 402;
this.height = 302;

this.setStyle("backgroundColor", 0x333333);


this.addEventListener(MouseEvent.CLICK, handleClick);
this.addEventListener(MouseEvent.ROLL_OUT, chiudi);
}

overrideprotectedfunction createChildren():void
{
thumb = new Image();
thumb.width = 400;
thumb.height = 300;
thumb.x = 1;
thumb.y = 1;
thumb.source = thumbnail;
this.addChild(thumb);

btn = new Button();
btn.label = "play";
btn.setStyle("verticalCenter", 0);
btn.setStyle("horizontalCenter", 0);
this.addChild(btn);
}

privatefunction updateDisplay(event:Event):void
{
if (isPlaying)
{
this.dispatchEvent(new FlexEvent(FlexEvent.UPDATE_COMPLETE));
}
}

privatefunction chiudi(event:Event):void
{
if (isPlaying)
{
isPlaying = false;
video.close();
this.removeChild(video);
}
}

privatefunction handleClick(event:Event):void
{
if (isPlaying)
{
isPlaying = false;
if (this.contains(video))
{
video.close();
this.removeChild(video);
}
this.dispatchEvent(new FlexEvent(FlexEvent.UPDATE_COMPLETE));
}
else
{
isPlaying = true;

video = new VideoDisplay();
video.width = 400
video.height = 300
video.x = 1;
video.y = 1;
video.source = flv;
video.addEventListener(Event.ENTER_FRAME, updateDisplay);
this.addChild(video);
this.dispatchEvent(new FlexEvent(FlexEvent.UPDATE_COMPLETE));
}
}

}
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

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

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


All times are GMT. The time now is 17:23.


Powered by vBulletin versione 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap


FlepStudio
by Filippo Lughi
P.IVA 03605860406