Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

Recompile 4.0 with FlashDevelop, FDT or Flex SDK

26 replies [Last post]

Hi all,

I'd like to make some modifications to the JW FLV player 4.0 and then recompile it with the free FlashDevelop and FlexSDK 3.0 from Adobe. I can't seem to get it to work, does anybody have experience making this work?

Thanks,

webmania

I haven't tested this, but would like to get this working. Do you do this on a MAC (is this possible on a MAC)? And what errors do you get when compiling?

I created an as3project and this is what I am getting:

Running process: C:\Program Files\FlashDevelop\FirstRun\Tools\fdbuild\fdbuild.exe "D:\svn\jwplayer4\talesplayer.as3proj" -ipc 023c88f2-8d27-481b-86e5-9b3850eda66d -compiler "C:\FlexSDK3" -library "C:\Program Files\FlashDevelop\FirstRun\Library"
Using the Flex Compiler Shell.
Building talesplayer
mxmlc -load-config+=obj\talesplayerConfig.xml -debug=true -incremental=true -benchmark=false -warnings=false -o obj\talesplayer633512002730937500
INITIALIZING: Adobe Flex Compiler SHell (fcsh)
D:\svn\jwplayer4\com\jeroenwijering\events\AbstractView.as(25): col: 63 Warning: return value for function 'addControllerListener' has no type declaration.
public function addControllerListener(typ:String,fcn:Function) {};
^
D:\svn\jwplayer4\com\jeroenwijering\events\AbstractView.as(26): col: 58 Warning: return value for function 'addModelListener' has no type declaration.
public function addModelListener(typ:String,fcn:Function) {};
.....

this goes on for a while and eventually I get

.....
D:\svn\jwplayer4\com\jeroenwijering\models\RTMPModel.as(237): col: 7 Warning: variable 'dur' has no type declaration.
var dur = model.playlist[model.config['item']]['duration'];
^
D:\svn\jwplayer4\com\jeroenwijering\models\RTMPModel.as(253): col: 35 Warning: return value for function 'volume' has no type declaration.
public function volume(vol:Number) {
^
Build halted with errors (mxmlc).

I looked through all the error messages and they all seem to be warning messages with regard to the type declaration, though.

Thanks,

webmania

P.S.

I looked at the symbols contained in my output swf file (yes, the compilation does produce one even though it failed) and the stock player.swf. I noticed that the only difference is that the stock swf file contains all the player_fla* stuff. This makes me wonder maybe I am really close, if I can get FlashDeveloper to use player.fla somehow.

Hi -

Somewhere in the mess of warnings you're getting from mxmlc, can you see if you are getting any errors? I find it strange that mxmlc is outputting warnings, since the -warnings=false flag is set by FlashDevelop...

I went through all the messages thoroughly (I think), and didn't find any "error" messages, all "warning", which might explain why I am still getting an SWF file....

But apparently mxmlc or any other command line compilers cannot handle FLA files, so maybe I should ask for the SWC file, which FlashDevelop apparently can handle...

Hmm, strange the mxmlc compiler needs type declarations and the CS3 compiler not. I agree with Pablo, this shouldn't be what causes the compiler to fail.

hola!

we would like to share our experience when we were trying to use JW Player with FDT to show media in our flash projects.
you could not just load it with Loader or use the generated SWC with FDT. As we can see in your forum, with FlexBuilder
there seems to be some trouble with this too.

the swf problem
when you load JW Player with the Loader Class, the MovieClip.stage object used by the Skinner is instantiated before the
player is added to the stage, therefore it is null which causes the player to crash.

the swc problem
there is no Player.player property due to the nature of the SWC. the Skinner/Configger crashes.

our solution

1. in the FLA, export the player library symbol with Identifyer 'AssetPlayer'.
rest of the settings remain default: base class is 'flash.display.MovieClip', exporting for AS/first frame is checked.
this will be needed for the swc version

2. modify com.jeroenwijering.player.Player

/** Constructor; Loads config parameters.**/
public function Player() {
visible = false;

/* *******************************************************
* begin fdt mod:::
* ----------------
* wait to kick off player until really added to stage
* else you will have null in the stage property of the skin
* and you will not be able to compile in fdt
*/

// wait till the object is really added to stage
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);

/*
* --------------
* end fdt mod:::
* ******************************************************* */
};

/* *******************************************************
* begin fdt mod:::
* ----------------
*/

/**
* the kickoff is postboned until the player is added to stage
*/
private function onAddedToStage(e : Event) : void {
// clean up
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);

// if your using the swc approach no player instance is on the stage
if(this.player == null)
{
this.player = new AssetPlayer();
addChild(this.player);
}

//now everything goes the known way
configger = new Configger(this);
configger.addEventListener(Event.COMPLETE,configHandler);
configger.load(defaults);
}

/*
* --------------
* end fdt mod:::
* ******************************************************* */

3. For the swc option we added a simple getter setter to access the default values to the com.jeroenwijering.player.Player

[...]

public class Player extends MovieClip {

/** A list with all default configuration values. **/
//use an underscore
private var _defaults:Object = {
author:undefined,

[...]

/* *******************************************************
* begin fdt mod:::
* ----------------
*/

/**
* setter for accessing the default object via AS3
*/
public function set defaults(o:Object):void
{
for(var id:String in o)
{
_defaults[id] = o[id];
}
}

/**
* getter for accessing the default object via AS3
*/
public function get defaults():Object
{
return _defaults;
}

/*
* --------------
* end fdt mod:::
* ******************************************************* */

[...]

4. Recompile and use either the swf or swc.

Theres 2 simple examples how to use:

package 
{
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;
import flash.net.URLVariables;

//class definition
public class ApplicationExampleSWF extends Sprite
{

private var loader:Loader;

/* ----------------------------------------------------------------- */

public function Application() {
addJWPlayer();
}

private function addJWPlayer():void
{
loader = new Loader();

var url:String = "player.swf";
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();
variables.file = "video.flv";
request.data = variables;

loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onJWPlayerLoaded);
loader.load(request);
}

private function onJWPlayerLoaded( evt:Event ):void {
//this will kick off the player
addChild(loader);
}

}
}

package 
{
import flash.display.Sprite;

//class definition
public class ApplicationExampleSWC extends Sprite
{

public function Application() {
addJWPlayer();
}

private function addJWPlayer():void
{
var player : Player = new Player();
player.defaults = {file:"video.flv"};
addChild(player);
}

}
}

Hoping to have helped you a little bit ;-)

grx
nada

another problem.
the player resizes automatically to stage.stageWidth/stage.stageHeight, but if you embed it in your flash pages you may want it to resize it to your desired sizes.
quick fix: listen to the View's Resize event and resize it again if different from your desired dimensions...

package  {
import flash.display.Sprite;

import com.jeroenwijering.events.ViewEvent;
import com.jeroenwijering.player.Player;

//class definition
public class Application extends Sprite
{
private var player:Player;
private var pWidth:uint = 320;
private var pHeight:uint = 200;

/* ----------------------------------------------------------------- */

public function Application() {
addSWCJWPlayer();
}

/* ----------------------------------------------------------------- */

private function addSWCJWPlayer():void
{
player = new Player();
player.defaults = {file:"video.flv"};
player.visible = false;
addChild(player);
//wait for player to be added to stage...
_player.addEventListener(Event.ADDED_TO_STAGE, initMyResizer);
}    

private function initMyResizer(e:Event):void
{
//clean up
_player.removeEventListener(Event.ADDED_TO_STAGE, initMyResizer);

//register custom resizer to keep size on stage resize
_player.view.addViewListener(ViewEvent.RESIZE, keepMySize);
//resize it
_player.view.dispatchEvent(new ViewEvent(ViewEvent.RESIZE,{width:pWidth, height:pHeight}));
_player.visible = true;
}   

private function keepMySize(e:ViewEvent):void
{
if((e.data.width != pWidth) || (e.data.height != pHeight))
{
//resize it again
player.view.dispatchEvent(new ViewEvent(ViewEvent.RESIZE,{width:pWidth, height:pHeight}));
}
}

}
}

anyone a more elegant way?

tnx!
grx

Nada, thanks for the great insights! I'll take a look at those. Expect the added_to_stage to be in the default player. I believe the absense of Player.player has already been fixed in the 4.1...

An elegant solution for not-autoscaling when in larger apps is indeed on the todo list...

I too would like to make very small changes and recompile the ActionScript files (actually, just the yt.as file). I've got the latest source from Subversion, and I downloaded the free Flex3 SDK. I was hoping that I could just run a simple compile command (w/o having any builder or project set up). But, without any changes I get:

/Users/andyo/jeroenwijering_as3> mxmlc yt.as
Loading configuration file /Users/andyo/flex3sdk/frameworks/flex-config.xml
/Users/andyo/jeroenwijering_as3/yt.as: Error: A file found in a source-path must have an externally visible definition. If a definition in the file is meant to be externally visible, please put the definition in a package.

I'm a super n00b at AS. I've read elsewhere that I either need an MXML file describing the stage OR other AS doing the same. I can get around the above error by adding "package { }" around the contents of yt.as, but that's just leads to more OO-oriented errors. Sounds like the AS files have to be classes with the compiler/setup I'm trying to use.

Am I missing something from the source repository, or are the AS files valid for an earlier or different compiler/setup?

@JeroenW

I don't see the adjustments mentioned in the current version in the repository, but the todo list says they are done?

nada
Thanks!!!

I love your widgets!
I use them on my jukebox at www.mySpace.com/Pepe_Rockola.

I'm trying to install your player23e MP3 player widget on Facebook, and in the appropriate fbml box I have entered this:
<fb:swf height="310" width="240" swfbgcolor="000000" imgstyle="border-width:0px; border-color:white;"
swfsrc='http://www.fileden.com/files/2010/2/9/2756067/jukebox/player.swf'
flashvars='playlist=http://www.fileden.com/files/2010/2/9/2756067/jukebox/playlist.xml&config=http://www.fileden.com/files/2010/2/9/2756067/jukebox/config.xml' width='240' height='310'
imgsrc='http://www.fileden.com/files/2010/2/9/2756067/MyJukebox3.gif' width='270' height='310'
/>

The player displays, correctly configured, but responds with playlist not found.
I'm confounded after trying to figuring this out for the past 3 days.

Here's how my playlist looks:
<?xml version="1.0" encoding="UTF-8" ?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<title>Pepe Rockola</title>
<location>http://www.fileden.com/files/2010/2/9/2756067/Elton%20John/</location>
<trackList>
<annotation>Elton John</annotation>
<track>
<annotation>Sacrifice</annotation>
<location>http://www.fileden.com/files/2010/2/9/2756067/Elton%20John/Sacrifice.mp3</location>
</track>
<track>
<annotation>Candle in The Wind</annotation>
<location>http://www.fileden.com/files/2010/2/9/2756067/Elton%20John/Candle%20In%20The%20Wind.mp3</location>
</track>
<track>
<annotation>Goodbye Yellow Brick Road</annotation>
<location>http://www.fileden.com/files/2010/2/9/2756067/Elton%20John/Goodbye%20Yellow%20Brick%20Road.mp3</location>
</track>
<track>
<annotation>Bennie and The Jets</annotation>
<location>http://www.fileden.com/files/2010/2/9/2756067/Elton%20John/Bennie%20and%20The%20Jets.mp3</location>
</track>
<track>
<annotation>Rocket Man</annotation>
<location>http://www.fileden.com/files/2010/2/9/2756067/Elton%20John/Rocket%20Man.mp3</location>
</track>
<track>
<annotation>Honky Cat</annotation>
<location>http://www.fileden.com/files/2010/2/9/2756067/Elton%20John/Honky%20Cat.mp3</location>
</track>
<track>
<annotation>Time</annotation>
<location>http://www.fileden.com/files/2010/2/9/2756067/Pink%20Floyd/Time.mp3</location>
</track>
<track>
<annotation>Us and Them</annotation> <location>http://www.fileden.com/files/2010/2/9/2756067/Pink%20Floyd/Us%20and%20Them.mp3</location>
</track>
<track>
<annotation>Comfortably Numb</annotation> <location>http://www.fileden.com/files/2010/2/9/2756067/Pink%20Floyd/Comfortably%20Numb.mp3</location>
</track>
</trackList>
</playlist>

I'm pretty sure I've gotten all the syntax correct, because the swf works on my computer, and accesses the files over the web, but doesn't find the playlist from the host server.

The widget and the mp3s are all located on the same server, so I wouldn't think I'd need a crossserver.xml.
Please advise me.

On a similar matter, when I try to use your Mixpod MP3 player, on Facebook, the playlist defaults to 4 songs by skrapz. How can I direct it to my playlist.xml?

Thanks for any help.

Pepe Rockola - Can you show a link to where you are trying to do this (on Facebook)?

This is the fbtm box tab on my Facebook artist profile
http://www.facebook.com/pages/Pepe-Rockola/108711715817362?v=box_3

I've got examples of your other widgets at http://www.MySpace.com/Pepe_Rockola

I meant fbml

I use a Facebook application called Static FBML to place the box in a tab.

I have never really worked with FMBL before, but I would look into your code, checking in Firebug, it never even tries to load player.swf

Okay, thanks.
I'll install Firebug and see what I can come up with.

Np

Well, As the old saying goes,
"If all else fails..."
I went to the instruction site (http://blogs.myspace.com/index.cfm?fuseaction=blog.view&friendId=9966777&blogId=171902752) and discovered that instead of declaring flashvar=playlist, I should have declared flashvar =file.
Everything works smoothly now.
Thanks very much for guiding me.
Happy Easter

Here's a link to fpml developers' http://wiki.developers.facebook.com/index.php/FBML

Here's the code I finally got to work on Facebook:
<fb:swf height="360" width="270" swfbgcolor="000000" imgstyle="border-width:0px; border-color:white;"
swfsrc='http://www.fileden.com/files/2010/2/9/2756067/jukebox/player.swf'
imgsrc='http://www.fileden.com/files/2010/2/9/2756067/MyJukebox3.gif' width='100%'
flashvars='config=http://www.fileden.com/files/2010/2/9/2756067/jukebox/config.xml&file=http://www.fileden.com/files/2010/2/9/2756067/jukebox/playlist.xml' width='270' height='360'
/>

I thoroughly enjoy your widgets!

Nice :)

I have a mixpod player and i want to put it in my fan page? how to do that? somebody please help

What is the code for the mixpod player?