Skip to content

Instantly share code, notes, and snippets.

@lovasoa
Last active March 28, 2020 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lovasoa/f296b5e08bf7a94bb6800719bdd78b89 to your computer and use it in GitHub Desktop.
Save lovasoa/f296b5e08bf7a94bb6800719bdd78b89 to your computer and use it in GitHub Desktop.
Naoned viewer image URL computation
public function on_complete_load_xml(param1:Event) : void
{
var _loc3_:* = undefined;
var _loc4_:* = undefined;
var _loc7_:* = undefined;
var _loc8_:* = undefined;
var _loc9_:* = undefined;
var _loc10_:MovieClip = null;
is_authorize_mainclip = true;
var _loc2_:XML = new XML(param1.target.data);
for each(_loc3_ in _loc2_.layer)
{
layer_w.push(_loc3_.@w);
layer_h.push(_loc3_.@h);
layer_z.push(_loc3_.@z);
layer_t.push(_loc3_.@t);
_loc7_ = 1;
if(_loc3_.@t > 0)
{
_loc7_ = Math.ceil(_loc3_.@w / _loc3_.@t) * Math.ceil(_loc3_.@h / _loc3_.@t);
}
layer_nbt.push(_loc7_);
_loc8_ = new Array();
_loc9_ = 0;
while(_loc9_ < _loc7_)
{
_loc8_[_loc9_] = false;
_loc9_++;
}
layer_loadt.push(_loc8_);
if(_loc3_.@z == 1)
{
pict_w = _loc3_.@w;
pict_h = _loc3_.@h;
}
_loc10_ = new MovieClip();
_loc10_.x = 0;
_loc10_.y = 0;
_loc10_.visible = false;
_loc10_.forceSmoothing = true;
_loc10_.width = _loc3_.@w;
_loc10_.height = _loc3_.@h;
_loc10_.scaleX = 1 / _loc3_.@z;
_loc10_.scaleY = 1 / _loc3_.@z;
layer_clips.push(_loc10_);
nb_layers++;
}
mainclip.scaleX = zoom;
mainclip.scaleY = zoom;
set_position_xy();
create_contrast_clip();
_loc4_ = 0;
while(_loc4_ < nb_layers)
{
mainclip.addChild(layer_clips[_loc4_]);
_loc4_++;
}
if(download_picture == "1")
{
btn_download.visible = true;
btn_download_graph.visible = true;
}
if(is_selectif != "" && playlist_file.g[cur_group].i[cur_item].a[0].attribute("ps").length() != 0)
{
check_ps_autorisation(playlist_file.g[cur_group].i[cur_item].a[0].attribute("ps"));
if(!is_authorize)
{
dialog_publication_selective.visible = true;
btn_download.visible = false;
btn_download_graph.visible = false;
is_authorize_mainclip = false;
is_authorize = true;
}
else
{
dialog_publication_selective.visible = false;
}
}
else
{
dialog_publication_selective.visible = false;
}
if(!is_jeton_authorize)
{
dialog_publication_selective.visible = true;
btn_download.visible = false;
btn_download_graph.visible = false;
is_authorize_mainclip = false;
is_authorize = true;
}
if(is_authorize_mainclip)
{
create_negative_clip();
create_brightness_clip();
create_contrast_sub_clip();
active_layer(0);
}
var _loc5_:String = playlist_file.attribute("basepath");
while(clip_thumbnail_prev2.numChildren)
{
clip_thumbnail_prev2.removeChildAt(0);
}
while(clip_thumbnail_prev1.numChildren)
{
clip_thumbnail_prev1.removeChildAt(0);
}
while(clip_thumbnail.numChildren)
{
clip_thumbnail.removeChildAt(0);
}
while(clip_thumbnail_next1.numChildren)
{
clip_thumbnail_next1.removeChildAt(0);
}
while(clip_thumbnail_next2.numChildren)
{
clip_thumbnail_next2.removeChildAt(0);
}
if(cur_item > 1)
{
if(is_selectif != "" && playlist_file.g[cur_group].i[cur_item - 2].a[0].attribute("ps").length() != 0)
{
check_ps_autorisation(playlist_file.g[cur_group].i[cur_item - 2].a[0].attribute("ps"));
}
if(is_authorize)
{
load_thumbnail(_loc5_ + playlist_file.g[cur_group].i[cur_item - 2].a[0],clip_thumbnail_prev2);
}
else
{
load_thumbnail_selectif(clip_thumbnail_prev2);
is_authorize = true;
}
}
if(cur_item > 0)
{
if(is_selectif != "" && playlist_file.g[cur_group].i[cur_item - 1].a[0].attribute("ps").length() != 0)
{
check_ps_autorisation(playlist_file.g[cur_group].i[cur_item - 1].a[0].attribute("ps"));
}
if(is_authorize)
{
load_thumbnail(_loc5_ + playlist_file.g[cur_group].i[cur_item - 1].a[0],clip_thumbnail_prev1);
}
else
{
load_thumbnail_selectif(clip_thumbnail_prev1);
is_authorize = true;
}
}
if(is_authorize_mainclip)
{
load_thumbnail(_loc5_ + playlist_file.g[cur_group].i[cur_item].a[0],clip_thumbnail);
}
else
{
load_thumbnail_selectif(clip_thumbnail);
}
if(cur_item < playlist_file.g[cur_group].i.length() - 1)
{
if(is_selectif != "" && playlist_file.g[cur_group].i[cur_item + 1].a[0].attribute("ps").length() != 0)
{
check_ps_autorisation(playlist_file.g[cur_group].i[cur_item + 1].a[0].attribute("ps"));
}
if(is_authorize)
{
load_thumbnail(_loc5_ + playlist_file.g[cur_group].i[cur_item + 1].a[0],clip_thumbnail_next1);
}
else
{
load_thumbnail_selectif(clip_thumbnail_next1);
is_authorize = true;
}
}
if(cur_item < playlist_file.g[cur_group].i.length() - 2)
{
if(is_selectif != "" && playlist_file.g[cur_group].i[cur_item + 2].a[0].attribute("ps").length() != 0)
{
check_ps_autorisation(playlist_file.g[cur_group].i[cur_item + 2].a[0].attribute("ps"));
}
if(is_authorize)
{
load_thumbnail(_loc5_ + playlist_file.g[cur_group].i[cur_item + 2].a[0],clip_thumbnail_next2);
}
else
{
load_thumbnail_selectif(clip_thumbnail_next2);
is_authorize = true;
}
}
old_cur_item = cur_item;
var _loc6_:* = rotate;
if(!is_zoom_lock)
{
fit_height();
}
if(!is_lock)
{
set_negative_off();
brightness = 0;
old_brightness = 0;
if(is_zoom_lock)
{
calcul_active_layer();
}
if(filigrane != "" && is_authorize_mainclip)
{
apply_filigrane();
}
}
else
{
if(rotate != _loc6_)
{
rotate = _loc6_;
mainclip.rotation = rotate;
btn_rotate.btn_fond.alpha = rotate == 0?0:1;
set_position_xy();
}
calcul_active_layer();
if(is_negative)
{
set_negative_on();
}
else
{
set_negative_off();
}
apply_brightness();
apply_contrast();
if(filigrane != "" && is_authorize_mainclip)
{
apply_filigrane();
}
}
if(is_authorize_mainclip)
{
create_indexation_clip();
}
if(is_zoom_lock)
{
active_mode_move();
}
if(index_form != "")
{
if(index_form.search("persname") != -1)
{
tf_persname = "1";
}
if(index_form.search("lastname") != -1)
{
tf_nom = "1";
}
if(index_form.search("firstname") != -1)
{
tf_prenom = "1";
}
if(index_form.search("unitdate") != -1)
{
tf_date = "1";
}
if(index_form.search("normaldate") != -1)
{
tf_date2 = "1";
}
if(index_form.search("geogname") != -1)
{
tf_lieu = "1";
}
if(index_form.search("geogname2") != -1)
{
tf_lieu2 = "1";
}
if(index_form.search("geogname3") != -1)
{
tf_lieu3 = "1";
}
if(index_form.search("geogname4") != -1)
{
tf_lieu4 = "1";
}
if(index_form.search("subject") != -1)
{
tf_mat = "1";
}
if(index_form.search("type_acte") != -1)
{
tf_acte = "1";
}
if(index_form.search("description") != -1)
{
tf_desc = "1";
}
}
if(indexzone_form != "")
{
if(indexzone_form.search("persname") != -1)
{
tf_persname_zone = "1";
}
if(indexzone_form.search("lastname") != -1)
{
tf_nom_zone = "1";
}
if(indexzone_form.search("firstname") != -1)
{
tf_prenom_zone = "1";
}
if(indexzone_form.search("unitdate") != -1)
{
tf_date_zone = "1";
}
if(indexzone_form.search("normaldate") != -1)
{
tf_date2_zone = "1";
}
if(indexzone_form.search("geogname") != -1)
{
tf_lieu_zone = "1";
}
if(indexzone_form.search("geogname2") != -1)
{
tf_lieu2_zone = "1";
}
if(indexzone_form.search("geogname3") != -1)
{
tf_lieu3_zone = "1";
}
if(indexzone_form.search("geogname4") != -1)
{
tf_lieu4_zone = "1";
}
if(indexzone_form.search("subject") != -1)
{
tf_mat_zone = "1";
}
if(indexzone_form.search("type_acte") != -1)
{
tf_acte_zone = "1";
}
if(indexzone_form.search("description") != -1)
{
tf_desc_zone = "1";
}
}
if(!is_authorize_mainclip)
{
clip_win.width = 60;
clip_win.height = 46;
clip_win.x = clip_thumbnail.x;
clip_win.y = clip_thumbnail.y + 7;
}
}
public function check_and_display_tiles() : *
{
var _loc10_:Boolean = false;
var _loc11_:Boolean = false;
var _loc12_:int = 0;
var _loc13_:int = 0;
var _loc14_:int = 0;
var _loc15_:int = 0;
var _loc16_:int = 0;
var _loc17_:int = 0;
var _loc18_:int = 0;
var _loc19_:int = 0;
var _loc20_:int = 0;
var _loc21_:* = null;
var _loc22_:URLRequest = null;
var _loc23_:Loader = null;
var _loc24_:* = undefined;
var _loc1_:* = layer_nbt[cur_layer];
var _loc2_:* = true;
var _loc3_:* = pict_w * zoom;
var _loc4_:* = pict_h * zoom;
if(rotate == 90 || rotate == 270)
{
_loc3_ = pict_h * zoom;
_loc4_ = pict_w * zoom;
}
var _loc5_:* = (0 - mainclip.x) / zoom;
var _loc6_:* = (hheader - mainclip.y) / zoom;
var _loc7_:* = _loc5_ + wscreen / zoom;
var _loc8_:* = _loc6_ + hscreen / zoom;
if(rotate == 90)
{
_loc5_ = (hheader - mainclip.y) / zoom;
_loc6_ = (mainclip.x - wscreen) / zoom;
_loc7_ = _loc5_ + hscreen / zoom;
_loc8_ = _loc6_ + wscreen / zoom;
}
else if(rotate == 180)
{
_loc5_ = (mainclip.x - wscreen) / zoom;
_loc6_ = (mainclip.y - (hscreen + hheader)) / zoom;
_loc7_ = _loc5_ + wscreen / zoom;
_loc8_ = _loc6_ + (hscreen + hheader) / zoom;
}
else if(rotate == 270)
{
_loc5_ = (mainclip.y - (hscreen + hheader)) / zoom;
_loc6_ = (0 - mainclip.x) / zoom;
_loc7_ = _loc5_ + hscreen / zoom;
_loc8_ = _loc6_ + wscreen / zoom;
}
var _loc9_:* = 0;
while(_loc9_ < _loc1_)
{
if(!layer_loadt[cur_layer][_loc9_])
{
_loc10_ = false;
_loc11_ = false;
_loc12_ = 0;
_loc13_ = 0;
_loc14_ = layer_t[cur_layer];
if(_loc1_ > 1)
{
_loc15_ = Math.ceil(layer_w[cur_layer] / _loc14_);
_loc16_ = Math.ceil(layer_h[cur_layer] / _loc14_);
_loc17_ = Math.floor(_loc9_ / _loc15_);
_loc18_ = _loc9_ - _loc17_ * _loc15_;
_loc12_ = _loc18_ * _loc14_;
_loc13_ = _loc17_ * _loc14_;
_loc19_ = _loc12_ + _loc14_ - 1;
_loc20_ = _loc13_ + _loc14_ - 1;
if(_loc19_ > layer_w[cur_layer] - 1)
{
_loc19_ = layer_w[cur_layer] - 1;
}
if(_loc20_ > layer_h[cur_layer] - 1)
{
_loc20_ = layer_h[cur_layer] - 1;
}
if(_loc12_ / layer_z[cur_layer] <= _loc7_ && _loc19_ / layer_z[cur_layer] >= _loc5_ && _loc13_ / layer_z[cur_layer] <= _loc8_ && _loc20_ / layer_z[cur_layer] >= _loc6_)
{
_loc10_ = true;
_loc11_ = true;
_loc2_ = true;
}
else if(_loc2_)
{
_loc10_ = true;
_loc11_ = true;
_loc2_ = false;
}
}
else
{
_loc10_ = true;
}
if(_loc10_)
{
layer_loadt[cur_layer][_loc9_] = true;
_loc21_ = "";
if(_loc1_ == 1)
{
_loc21_ = http_viewer + picture_filename + cur_layer + "_0.jpg?845135=624857";
}
else
{
_loc24_ = Math.round(layer_z[cur_layer] * 100000);
_loc21_ = http_viewer + picture_filename + cur_layer + "_" + _loc9_ + ".jpg?845135=624857";
}
_loc22_ = new URLRequest(url_utf8(_loc21_));
_loc23_ = new Loader();
nb_obj_loading++;
clip_loader.visible = true;
text_loader.text = "Mise au point...";
text_loader.visible = true;
nb_loadings.text = nb_obj_loading;
_loc23_.contentLoaderInfo.addEventListener(Event.COMPLETE,imageLoaded);
_loc23_.x = _loc12_;
_loc23_.y = _loc13_;
_loc23_.load(_loc22_);
layer_clips[cur_layer].addChild(_loc23_);
}
}
_loc9_++;
}
show_layer_actif();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment