bomberstudios-fluby 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.mdown +5 -0
- data/Rakefile +67 -0
- data/bin/fluby +15 -0
- data/lib/fluby.rb +59 -0
- data/lib/templates/ASClass.as +9 -0
- data/lib/templates/README +51 -0
- data/lib/templates/Rakefile +81 -0
- data/lib/templates/index.rhtml +16 -0
- data/lib/templates/project.rxml +14 -0
- data/lib/templates/swfobject.js +230 -0
- metadata +62 -0
data/README.mdown
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
##### Requirements
|
2
|
+
|
3
|
+
require 'rake'
|
4
|
+
|
5
|
+
require 'rake/clean'
|
6
|
+
require 'rake/gempackagetask'
|
7
|
+
require 'rake/testtask'
|
8
|
+
|
9
|
+
require File.dirname(__FILE__) + '/lib/fluby.rb'
|
10
|
+
|
11
|
+
##### Cleaning
|
12
|
+
CLEAN.include [ 'tmp', 'test/fixtures/*/output/*', 'test/fixtures/*/tmp' ]
|
13
|
+
CLOBBER.include [ 'pkg' ]
|
14
|
+
|
15
|
+
##### Packaging
|
16
|
+
spec = Gem::Specification.new do |s|
|
17
|
+
s.name = Fluby::NAME
|
18
|
+
s.version = Fluby::VERSION
|
19
|
+
s.platform = Gem::Platform::RUBY
|
20
|
+
s.summary = 'A simple command to create an empty project for MTASC + SWFMILL + Rake'
|
21
|
+
s.description = s.summary
|
22
|
+
s.homepage = 'http://fluby.googlecode.com/'
|
23
|
+
s.author = 'Ale Muñoz'
|
24
|
+
s.email = 'ale@bomberstudios.com'
|
25
|
+
|
26
|
+
s.rubyforge_project = 'fluby'
|
27
|
+
|
28
|
+
s.required_ruby_version = '>= 1.8.5'
|
29
|
+
|
30
|
+
s.has_rdoc = false
|
31
|
+
s.files = FileList.new("README.mdown","Rakefile","bin/**/*","lib/**/*").to_a
|
32
|
+
s.executables = [ 'fluby' ]
|
33
|
+
s.require_path = 'lib'
|
34
|
+
s.bindir = 'bin'
|
35
|
+
end
|
36
|
+
|
37
|
+
Rake::GemPackageTask.new(spec) { |task| }
|
38
|
+
|
39
|
+
task :install do
|
40
|
+
if RUBY_PLATFORM =~ /mswin32/
|
41
|
+
system('cmd.exe /c rake package')
|
42
|
+
system("cmd.exe /c gem install pkg/#{Fluby::NAME}-#{Fluby::VERSION}")
|
43
|
+
else
|
44
|
+
system('rake package')
|
45
|
+
system("sudo gem install pkg/#{Fluby::NAME}-#{Fluby::VERSION}")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
task :uninstall do
|
50
|
+
sh %{sudo gem uninstall #{Fluby::NAME}}
|
51
|
+
end
|
52
|
+
|
53
|
+
### Testing
|
54
|
+
|
55
|
+
Rake::TestTask.new(:test) do |test|
|
56
|
+
test.test_files = Dir['test/test_*.rb']
|
57
|
+
end
|
58
|
+
|
59
|
+
task :github do
|
60
|
+
require 'rubygems/specification'
|
61
|
+
data = File.read('fluby.gemspec')
|
62
|
+
github_spec = nil
|
63
|
+
Thread.new { github_spec = eval("$SAFE = 3\n#{data}") }.join
|
64
|
+
puts github_spec
|
65
|
+
end
|
66
|
+
|
67
|
+
task :default => [ :install ]
|
data/bin/fluby
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Fluby Generator <http://fluby.googlecode.com>
|
3
|
+
# Handcrafted with love by bomberstudios & mamuso
|
4
|
+
# 2008-03-16
|
5
|
+
|
6
|
+
require File.dirname(__FILE__) + '/../lib/fluby.rb'
|
7
|
+
|
8
|
+
# Display help
|
9
|
+
if ARGV[0].nil?
|
10
|
+
puts "Fluby v#{Fluby::VERSION}"
|
11
|
+
puts "Usage: fluby project_name"
|
12
|
+
exit
|
13
|
+
end
|
14
|
+
|
15
|
+
Fluby.create_project(ARGV[0])
|
data/lib/fluby.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
module Fluby
|
2
|
+
NAME = 'fluby'
|
3
|
+
VERSION = '0.5.7'
|
4
|
+
|
5
|
+
def self.create_project(name)
|
6
|
+
require "fileutils"
|
7
|
+
require "erb"
|
8
|
+
|
9
|
+
# TODO: Support project creation in subfolders (i.e: fluby test/project)
|
10
|
+
@project_name = name
|
11
|
+
@project_folder = FileUtils.pwd + "/" + @project_name
|
12
|
+
|
13
|
+
# Make folders
|
14
|
+
if File.exist? @project_folder
|
15
|
+
puts "Folder #{@project_name} already exists,"
|
16
|
+
puts "please choose a different name for your project"
|
17
|
+
exit
|
18
|
+
end
|
19
|
+
FileUtils.mkdir [@project_folder,"#{@project_folder}/deploy","#{@project_folder}/assets"]
|
20
|
+
|
21
|
+
# Make files
|
22
|
+
["Rakefile","README"].each do |file|
|
23
|
+
render_template file
|
24
|
+
end
|
25
|
+
|
26
|
+
# Static Templates
|
27
|
+
copy_template "index.rhtml"
|
28
|
+
copy_template "project.rxml", "#{@project_name}.rxml"
|
29
|
+
copy_template "swfobject.js", "deploy/swfobject.js"
|
30
|
+
|
31
|
+
# Main Class
|
32
|
+
render_template "ASClass.as", "#{@project_name}.as"
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.copy_template source, destination=nil
|
37
|
+
if destination.nil?
|
38
|
+
destination = source
|
39
|
+
end
|
40
|
+
FileUtils.cp "#{File.dirname(__FILE__)}/templates/#{source}", "#{@project_folder}/#{destination}"
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.render_template source, destination=nil
|
44
|
+
if destination.nil?
|
45
|
+
destination = source
|
46
|
+
end
|
47
|
+
open("#{@project_folder}/#{destination}","w") do |f|
|
48
|
+
f << ERB.new(IO.read("#{File.dirname(__FILE__)}/templates/#{source}")).result(binding)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.is_mac?
|
53
|
+
return RUBY_PLATFORM =~ /darwin/
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.has_growl?
|
57
|
+
return is_mac? && !`which "growlnotify"`.empty?
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
|
2
|
+
<%= @project_name %>
|
3
|
+
<%= "="*@project_name.length %>
|
4
|
+
|
5
|
+
This is the README for the <%= @project_name %> project.
|
6
|
+
|
7
|
+
Compilation
|
8
|
+
-----------
|
9
|
+
<%= @project_name %> has been created using fluby, so compilation is pretty straightforward:
|
10
|
+
|
11
|
+
$ cd <%= @project_name %>
|
12
|
+
$ rake
|
13
|
+
|
14
|
+
There are some additional rake tasks available:
|
15
|
+
<% if RUBY_PLATFORM =~ /mswin32/ %>
|
16
|
+
<%= %x(cmd.exe /c rake -f "#{@project_folder}/Rakefile" -T -s) %>
|
17
|
+
<% else %>
|
18
|
+
<%= %x(rake -f "#{@project_folder}/Rakefile" -T -s) %>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
Assets
|
22
|
+
------
|
23
|
+
When compiling, fluby imports all assets in the 'assets' directory.
|
24
|
+
|
25
|
+
PNG files are imported as MovieClips, with their name (minus extension) as an ID. Thus, if you have a 'background.png' file, you can use it on your code with:
|
26
|
+
|
27
|
+
var my_clip = attachMovie("background","my_clip_name",1);
|
28
|
+
|
29
|
+
TTF fonts are also imported. If you need to use multiple weights of the same family (i.e: regular, bold, italics...) you should name your fonts like this:
|
30
|
+
|
31
|
+
family_name-font_weight.ttf
|
32
|
+
|
33
|
+
So, if you were to use Arial, you'd use:
|
34
|
+
|
35
|
+
arial-regular.ttf
|
36
|
+
arial-bold.ttf
|
37
|
+
arial-italic.ttf
|
38
|
+
arial-bold_italic.ttf
|
39
|
+
|
40
|
+
Then, in your code, you'd use the fonts like this:
|
41
|
+
|
42
|
+
createTextField("txtest",1,0,0,200,30);
|
43
|
+
txtest.embedFonts = true;
|
44
|
+
var tf = new TextFormat();
|
45
|
+
tf.font = "arial";
|
46
|
+
tf.italic = true;
|
47
|
+
txtest.setNewTextFormat(tf);
|
48
|
+
txtest.text = "This is italics";
|
49
|
+
|
50
|
+
---
|
51
|
+
Created: <%= Time.now %>
|
@@ -0,0 +1,81 @@
|
|
1
|
+
WIDTH = 725
|
2
|
+
HEIGHT = 480
|
3
|
+
FPS = 31
|
4
|
+
PLAYER = 8
|
5
|
+
BGCOLOR = "#ffffff"
|
6
|
+
APP = "<%= @project_name %>"
|
7
|
+
|
8
|
+
require "erb"
|
9
|
+
|
10
|
+
def render_template(file)
|
11
|
+
filename = File.basename(file).split(".")[0]
|
12
|
+
case File.basename(file).split(".")[1]
|
13
|
+
when "rhtml"
|
14
|
+
extension = "html"
|
15
|
+
when "rxml"
|
16
|
+
extension = "xml"
|
17
|
+
end
|
18
|
+
to_file = filename + "." + extension
|
19
|
+
puts "Rendering #{file}"
|
20
|
+
open(to_file,"w") do |f|
|
21
|
+
f << ERB.new(IO.read(file)).result
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
task :compile do
|
26
|
+
if @nodebug
|
27
|
+
puts "Trace disabled"
|
28
|
+
trace = " -trace no"
|
29
|
+
else
|
30
|
+
trace = ""
|
31
|
+
end
|
32
|
+
@start = Time.now
|
33
|
+
["*.rhtml","*.rxml"].each do |list|
|
34
|
+
Dir[list].each do |tpl|
|
35
|
+
render_template(tpl)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
puts %x(swfmill simple #{APP}.xml #{APP}.swf)
|
39
|
+
rm "#{APP}.xml"
|
40
|
+
puts %x(mtasc -swf #{APP}.swf -main -mx -version #{PLAYER} #{trace} #{APP}.as)
|
41
|
+
@end = Time.now
|
42
|
+
|
43
|
+
["*.html","*.swf"].each do |list|
|
44
|
+
Dir[list].each do |file|
|
45
|
+
mv file, "deploy/#{file}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
<% if Fluby.has_growl? %>
|
51
|
+
task :notify do
|
52
|
+
msg = "Finished compiling in #{@end - @start}s."
|
53
|
+
if @nodebug
|
54
|
+
msg += "\ntrace() disabled"
|
55
|
+
end
|
56
|
+
%x(growlnotify --name Rake -m '#{msg}' 'Rake')
|
57
|
+
end
|
58
|
+
<% end %>
|
59
|
+
|
60
|
+
task :nodebug do
|
61
|
+
@nodebug = true
|
62
|
+
end
|
63
|
+
|
64
|
+
<% if Fluby.is_mac? %>
|
65
|
+
desc "Test the SWF file in your default browser"
|
66
|
+
task :test => [:compile] do
|
67
|
+
%x(open deploy/index.html)
|
68
|
+
end
|
69
|
+
<% end %>
|
70
|
+
|
71
|
+
<% if Fluby.has_growl? %>
|
72
|
+
desc "Build a release version of <%= @project_name %> (with trace() disabled)"
|
73
|
+
task :release => [:nodebug,:compile,:notify]
|
74
|
+
|
75
|
+
task :default => [:compile,:notify,:test]
|
76
|
+
<% else %>
|
77
|
+
desc "Build a release version of <%= @project_name %> (with trace() disabled)"
|
78
|
+
task :release => [:nodebug,:compile]
|
79
|
+
|
80
|
+
task :default => [:compile,:test]
|
81
|
+
<% end %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
2
|
+
<head>
|
3
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
4
|
+
<title><%= APP %></title>
|
5
|
+
<script type="text/javascript" src="swfobject.js"></script>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<div id="flashcontent">
|
9
|
+
This text is replaced by the Flash movie.
|
10
|
+
</div>
|
11
|
+
<script type="text/javascript">
|
12
|
+
var so = new SWFObject("<%= APP %>.swf", "mymovie", "<%= WIDTH %>", "<%= HEIGHT %>", "<%= PLAYER %>", "<%= BGCOLOR %>");
|
13
|
+
so.write("flashcontent");
|
14
|
+
</script>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<movie width="<%= WIDTH %>" height="<%= HEIGHT %>" framerate="<%= FPS %>" version="<%= PLAYER %>">
|
3
|
+
<background color="<%= BGCOLOR %>"/>
|
4
|
+
<frame>
|
5
|
+
<library>
|
6
|
+
<% Dir["assets/*.png"].each do |file| %>
|
7
|
+
<clip id="<%= File.basename(file,'.png') %>" import="<%= file %>"/>
|
8
|
+
<% end %>
|
9
|
+
<% Dir["assets/*.ttf"].each do |file| %>
|
10
|
+
<font id="<%= File.basename(file,'.ttf') %>" import="<%= file %>" name="<%= File.basename(file,'.ttf').split('-')[0] %>" glyphs="abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ01234567890,.-_¡!áéíóúÁÉÍÓÚüÜ\/• :;()¿?<>" />
|
11
|
+
<% end %>
|
12
|
+
</library>
|
13
|
+
</frame>
|
14
|
+
</movie>
|
@@ -0,0 +1,230 @@
|
|
1
|
+
/**
|
2
|
+
* SWFObject v1.5.1: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
|
3
|
+
*
|
4
|
+
* SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
|
5
|
+
* http://www.opensource.org/licenses/mit-license.php
|
6
|
+
*
|
7
|
+
*/
|
8
|
+
if(typeof deconcept == "undefined") var deconcept = {};
|
9
|
+
if(typeof deconcept.util == "undefined") deconcept.util = {};
|
10
|
+
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = {};
|
11
|
+
deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
|
12
|
+
if (!document.getElementById) { return; }
|
13
|
+
this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
|
14
|
+
this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
|
15
|
+
this.params = {};
|
16
|
+
this.variables = {};
|
17
|
+
this.attributes = [];
|
18
|
+
if(swf) { this.setAttribute('swf', swf); }
|
19
|
+
if(id) { this.setAttribute('id', id); }
|
20
|
+
if(w) { this.setAttribute('width', w); }
|
21
|
+
if(h) { this.setAttribute('height', h); }
|
22
|
+
if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
|
23
|
+
this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
|
24
|
+
if (!window.opera && document.all && this.installedVer.major > 7) {
|
25
|
+
// only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
|
26
|
+
// fixes bug in some fp9 versions see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
|
27
|
+
if (!deconcept.unloadSet) {
|
28
|
+
deconcept.SWFObjectUtil.prepUnload = function() {
|
29
|
+
__flash_unloadHandler = function(){};
|
30
|
+
__flash_savedUnloadHandler = function(){};
|
31
|
+
window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
|
32
|
+
}
|
33
|
+
window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
|
34
|
+
deconcept.unloadSet = true;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
if(c) { this.addParam('bgcolor', c); }
|
38
|
+
var q = quality ? quality : 'high';
|
39
|
+
this.addParam('quality', q);
|
40
|
+
this.setAttribute('useExpressInstall', false);
|
41
|
+
this.setAttribute('doExpressInstall', false);
|
42
|
+
var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
|
43
|
+
this.setAttribute('xiRedirectUrl', xir);
|
44
|
+
this.setAttribute('redirectUrl', '');
|
45
|
+
if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
|
46
|
+
}
|
47
|
+
deconcept.SWFObject.prototype = {
|
48
|
+
useExpressInstall: function(path) {
|
49
|
+
this.xiSWFPath = !path ? "expressinstall.swf" : path;
|
50
|
+
this.setAttribute('useExpressInstall', true);
|
51
|
+
},
|
52
|
+
setAttribute: function(name, value){
|
53
|
+
this.attributes[name] = value;
|
54
|
+
},
|
55
|
+
getAttribute: function(name){
|
56
|
+
return this.attributes[name] || "";
|
57
|
+
},
|
58
|
+
addParam: function(name, value){
|
59
|
+
this.params[name] = value;
|
60
|
+
},
|
61
|
+
getParams: function(){
|
62
|
+
return this.params;
|
63
|
+
},
|
64
|
+
addVariable: function(name, value){
|
65
|
+
this.variables[name] = value;
|
66
|
+
},
|
67
|
+
getVariable: function(name){
|
68
|
+
return this.variables[name] || "";
|
69
|
+
},
|
70
|
+
getVariables: function(){
|
71
|
+
return this.variables;
|
72
|
+
},
|
73
|
+
getVariablePairs: function(){
|
74
|
+
var variablePairs = [];
|
75
|
+
var key;
|
76
|
+
var variables = this.getVariables();
|
77
|
+
for(key in variables){
|
78
|
+
variablePairs[variablePairs.length] = key +"="+ variables[key];
|
79
|
+
}
|
80
|
+
return variablePairs;
|
81
|
+
},
|
82
|
+
getSWFHTML: function() {
|
83
|
+
var swfNode = "";
|
84
|
+
if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
|
85
|
+
if (this.getAttribute("doExpressInstall")) {
|
86
|
+
this.addVariable("MMplayerType", "PlugIn");
|
87
|
+
this.setAttribute('swf', this.xiSWFPath);
|
88
|
+
}
|
89
|
+
swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ (this.getAttribute('style') || "") +'"';
|
90
|
+
swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
|
91
|
+
var params = this.getParams();
|
92
|
+
for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
|
93
|
+
var pairs = this.getVariablePairs().join("&");
|
94
|
+
if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
|
95
|
+
swfNode += '/>';
|
96
|
+
} else { // PC IE
|
97
|
+
if (this.getAttribute("doExpressInstall")) {
|
98
|
+
this.addVariable("MMplayerType", "ActiveX");
|
99
|
+
this.setAttribute('swf', this.xiSWFPath);
|
100
|
+
}
|
101
|
+
swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ (this.getAttribute('style') || "") +'">';
|
102
|
+
swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
|
103
|
+
var params = this.getParams();
|
104
|
+
for(var key in params) {
|
105
|
+
swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
|
106
|
+
}
|
107
|
+
var pairs = this.getVariablePairs().join("&");
|
108
|
+
if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
|
109
|
+
swfNode += "</object>";
|
110
|
+
}
|
111
|
+
return swfNode;
|
112
|
+
},
|
113
|
+
write: function(elementId){
|
114
|
+
if(this.getAttribute('useExpressInstall')) {
|
115
|
+
// check to see if we need to do an express install
|
116
|
+
var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
|
117
|
+
if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
|
118
|
+
this.setAttribute('doExpressInstall', true);
|
119
|
+
this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
|
120
|
+
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
|
121
|
+
this.addVariable("MMdoctitle", document.title);
|
122
|
+
}
|
123
|
+
}
|
124
|
+
if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
|
125
|
+
var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
|
126
|
+
n.innerHTML = this.getSWFHTML();
|
127
|
+
return true;
|
128
|
+
}else{
|
129
|
+
if(this.getAttribute('redirectUrl') != "") {
|
130
|
+
document.location.replace(this.getAttribute('redirectUrl'));
|
131
|
+
}
|
132
|
+
}
|
133
|
+
return false;
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
/* ---- detection functions ---- */
|
138
|
+
deconcept.SWFObjectUtil.getPlayerVersion = function(){
|
139
|
+
var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
|
140
|
+
if(navigator.plugins && navigator.mimeTypes.length){
|
141
|
+
var x = navigator.plugins["Shockwave Flash"];
|
142
|
+
if(x && x.description) {
|
143
|
+
PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
|
144
|
+
}
|
145
|
+
}else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ // if Windows CE
|
146
|
+
var axo = 1;
|
147
|
+
var counter = 3;
|
148
|
+
while(axo) {
|
149
|
+
try {
|
150
|
+
counter++;
|
151
|
+
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
|
152
|
+
// document.write("player v: "+ counter);
|
153
|
+
PlayerVersion = new deconcept.PlayerVersion([counter,0,0]);
|
154
|
+
} catch (e) {
|
155
|
+
axo = null;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
} else { // Win IE (non mobile)
|
159
|
+
// do minor version lookup in IE, but avoid fp6 crashing issues
|
160
|
+
// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
|
161
|
+
try{
|
162
|
+
var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
|
163
|
+
}catch(e){
|
164
|
+
try {
|
165
|
+
var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
|
166
|
+
PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
|
167
|
+
axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
|
168
|
+
} catch(e) {
|
169
|
+
if (PlayerVersion.major == 6) {
|
170
|
+
return PlayerVersion;
|
171
|
+
}
|
172
|
+
}
|
173
|
+
try {
|
174
|
+
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
|
175
|
+
} catch(e) {}
|
176
|
+
}
|
177
|
+
if (axo != null) {
|
178
|
+
PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
|
179
|
+
}
|
180
|
+
}
|
181
|
+
return PlayerVersion;
|
182
|
+
}
|
183
|
+
deconcept.PlayerVersion = function(arrVersion){
|
184
|
+
this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
|
185
|
+
this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
|
186
|
+
this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
|
187
|
+
}
|
188
|
+
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
|
189
|
+
if(this.major < fv.major) return false;
|
190
|
+
if(this.major > fv.major) return true;
|
191
|
+
if(this.minor < fv.minor) return false;
|
192
|
+
if(this.minor > fv.minor) return true;
|
193
|
+
if(this.rev < fv.rev) return false;
|
194
|
+
return true;
|
195
|
+
}
|
196
|
+
/* ---- get value of query string param ---- */
|
197
|
+
deconcept.util = {
|
198
|
+
getRequestParameter: function(param) {
|
199
|
+
var q = document.location.search || document.location.hash;
|
200
|
+
if (param == null) { return q; }
|
201
|
+
if(q) {
|
202
|
+
var pairs = q.substring(1).split("&");
|
203
|
+
for (var i=0; i < pairs.length; i++) {
|
204
|
+
if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
|
205
|
+
return pairs[i].substring((pairs[i].indexOf("=")+1));
|
206
|
+
}
|
207
|
+
}
|
208
|
+
}
|
209
|
+
return "";
|
210
|
+
}
|
211
|
+
}
|
212
|
+
/* fix for video streaming bug */
|
213
|
+
deconcept.SWFObjectUtil.cleanupSWFs = function() {
|
214
|
+
var objects = document.getElementsByTagName("OBJECT");
|
215
|
+
for (var i = objects.length - 1; i >= 0; i--) {
|
216
|
+
objects[i].style.display = 'none';
|
217
|
+
for (var x in objects[i]) {
|
218
|
+
if (typeof objects[i][x] == 'function') {
|
219
|
+
objects[i][x] = function(){};
|
220
|
+
}
|
221
|
+
}
|
222
|
+
}
|
223
|
+
}
|
224
|
+
/* add document.getElementById if needed (mobile IE < 5) */
|
225
|
+
if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }}
|
226
|
+
|
227
|
+
/* add some aliases for ease of use/backwards compatibility */
|
228
|
+
var getQueryParamValue = deconcept.util.getRequestParameter;
|
229
|
+
var FlashObject = deconcept.SWFObject; // for legacy support
|
230
|
+
var SWFObject = deconcept.SWFObject;
|
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bomberstudios-fluby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.7
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- "Ale Mu\xC3\xB1oz"
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-08-13 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: A simple command to create an empty ActionScript project for MTASC + SWFMILL + Rake
|
17
|
+
email: bomberstudios@gmail.com
|
18
|
+
executables:
|
19
|
+
- fluby
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- README.mdown
|
26
|
+
- Rakefile
|
27
|
+
- bin/fluby
|
28
|
+
- lib/fluby.rb
|
29
|
+
- lib/templates/ASClass.as
|
30
|
+
- lib/templates/index.rhtml
|
31
|
+
- lib/templates/project.rxml
|
32
|
+
- lib/templates/Rakefile
|
33
|
+
- lib/templates/README
|
34
|
+
- lib/templates/swfobject.js
|
35
|
+
has_rdoc: false
|
36
|
+
homepage: http://github.com/bomberstudios/fluby/
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.8.5
|
47
|
+
version:
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: "0"
|
53
|
+
version:
|
54
|
+
requirements: []
|
55
|
+
|
56
|
+
rubyforge_project: fluby
|
57
|
+
rubygems_version: 1.2.0
|
58
|
+
signing_key:
|
59
|
+
specification_version: 2
|
60
|
+
summary: A simple command to create an empty ActionScript project for MTASC + SWFMILL + Rake
|
61
|
+
test_files: []
|
62
|
+
|