I am trying to set my mc to the exact screen size on an iPhone using air in as3.
I have tired:
import flash.display.Screen;
import flash.geom.Rectangle;
var mainScreen:Screen = Screen.mainScreen;
var screenBounds:Rectangle = mainScreen.bounds;
/// Does not work - comes out 320 by 480
w.text = ""+screenBounds.width+"";
h.text = ""+screenBounds.height+"";
BG.height = screenBounds.height;
BG.width = screenBounds.width;
/// Does not work - comes out 320 by 480
w.text = ""+Capabilities.screenResolutionX+"";
h.text = ""+Capabilities.screenResolutionY+"";
BG.height = Capabilities.screenResolutionY;
BG.width = Capabilities.screenResolutionX;
/// Does not work - comes out 320 by 480
w.text = ""+stage.fullScreenwidth+"";
h.text = ""+stage.fullScreenHeight+"";
BG.height = stage.fullScreenHeight;
BG.width = stage.fullScreenWidth;
/// Works BUT... it does NOT stretch to fit the stage.
/// I am starting with android screen size and it shrinks it proportionally
/// which means there is space on top or bottom or left side.
w.text = ""+stage.stageWidth+"";
h.text = ""+stage.stageHeight+"";
BG.height = stage.stageHeight;
BG.width= stage.stageWidth;
You can try to play around with stage.scaleMode :
stage.scaleMode = StageScaleMode.SHOW_ALL;
or
stage.scaleMode = StageScaleMode.EXACT_FIT;
If it is coming out 320x480 and you are saying that is wrong, can I assume you are using an iPhone 4S? If so, go into the App Descriptor XML file. Toward the bottom (generally one of the last items in the file), there should be this line.
<requestedDisplayResolution>standard</requestedDisplayResolution>
If it is commented out or set to "standard", this would be your issue. Change it to say "high" and that will enable Retina support. "standard" scales the non-retina display (320x480 on iPhone, 1024x768 on iPad) up. "high" will give you the correct display resolution.
Here is a detailed explanation:
http://www.adobe.com/devnet/air/articles/multiple-screen-sizes.html
if someone else is having issues getting the screen resolution for ios. What is happening is that there is no enough time between the completed loaded swf and the time you call the screen size.
For my app I need the swf with no scale because I am setting all my clips size and positions by setting a relative value to screen size in percent.
if my stage is 800x1280 and I have a clip with height = 100, width = 100;
then is the same to say that my clips.height = int(stage.stageWidth * 0.125);
as 100 * 100 / 800 = 12.5; | 100 is the 12.5% from 800;
The trick is that for your first frame (if you are using flash)
just set the stage scale and wait for full load the swf, and just that.
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
var loadTimer:Timer = new Timer(10);
loadTimer.addEventListener(TimerEvent.TIMER, loading);
loadTimer.start();
function loading(evt){
if(root.loaderInfo.bytesLoaded == root.loaderInfo.bytesTotal){
loadTimer.stop();
loadTimer.removeEventListener(TimerEvent.TIMER, loading);
gotoAndPlay(2);
}
}
then in the frame 2 you can call the stage.stageWidth and it will give you the real size, as you have give enough time to the app get that value.
var stageW:int = stage.stageWidth;
var stageH:int = stage.stageHeight;
I hope it can help, thanks
Related
I have an ARKit app that runs fine on iOS 12.x. On iOS 13 I encounter the following error in the console log:
[SceneKit] Error: Purging never freed texture <AGXA9FamilyTexture: 0x11d688240>
label = <none>
textureType = MTLTextureType2D
pixelFormat = MTLPixelFormatR16Float
width = 240
height = 1
depth = 1
arrayLength = 1
mipmapLevelCount = 1
sampleCount = 1
cpuCacheMode = MTLCPUCacheModeDefaultCache
storageMode = MTLStorageModePrivate
hazardTrackingMode = MTLHazardTrackingModeTracked
resourceOptions = MTLResourceCPUCacheModeDefaultCache MTLResourceStorageModePrivate MTLResourceHazardTrackingModeTracked
usage = MTLTextureUsageShaderRead MTLTextureUsageShaderWrite
shareable = 0
framebufferOnly = 0
purgeableState = MTLPurgeableStateNonVolatile
swizzle = [MTLTextureSwizzleRed, MTLTextureSwizzleGreen, MTLTextureSwizzleBlue, MTLTextureSwizzleAlpha]
isCompressed = 0
parentTexture = <null>
parentRelativeLevel = 0
parentRelativeSlice = 0
buffer = <null>
bufferOffset = 512
bufferBytesPerRow = 0
allowGPUOptimizedContents = YES
label = <none>
It repeats every few milliseconds and clutters the whole log. I was not able to narrow down where it comes from.
The interesting part is, that this even occurs when not a single node is present in the scene. If I remove the entire sceneView from the view then it disappears...(not an option)
Anybody any idea or hint how to track this down ?
Thanks
I fixed this issue by updating the setting of the scene camera:
var sceneView: ARSCNView!
...
sceneView.pointOfView?.camera?.wantsHDR = false
Hope this helps.
I have found the problem code line. In iOS 13 any call to
SceneView.snapshot()
produces that error. The apple docs say:
This method is thread-safe and may be called at any time.
but this seems to have changed in iOS13. I will file a bug report not hoping for a fast solution ;-)
I have three monitors in a horizontal line. Sometimes i want to maximize a window to three monitors at once, by pressing a combination of keys (and then returning it all back if necessary). How can I do that?
Untested, but the basic idea is to make the window floating and resize it to cover everything:
function(c)
c.floating = true
local geo = screen[1].geometry
geo.x2 = geo.x + geo.width
geo.y2 = geo.y + geo.height
for s in screen do
local geo2 = s.geometry
geo.x = math.min(geo.x, geo2.x)
geo.y = math.min(geo.y, geo2.y)
geo.x2 = math.max(geo.x2, geo2.x + geo2.width)
geo.y2 = math.max(geo.y2, geo2.y + geo2.height)
end
c:geometry{
x = geo.x,
y = geo.y,
width = geo.x2 - geo.x,
height = geo.y2 - geo.y
}
end
To undo the above, make the client no longer floating, i.e. c.floating = false.
Wiring the above to a keybinding is left as an exercise for the reader.
i need to use ListView1.TwoLinesAndBitmap
and i have strange problem to set lable,SecondLabel,imageview in center Vertically
as i see all examples set the itemheight to something like : 60dip
but when i test listview in some Hight resolution and density Device like Lenovo 10 inch tablet the height of itemheight will be very small
so i decide to use percent of Y as itemheight
here is my code : **********
ListView1.TwoLinesAndBitmap.ItemHeight = 10%y
ListView1.TwoLinesAndBitmap.ImageView.Height = ListView1.TwoLinesAndBitmap.ItemHeight - 20dip
ListView1.TwoLinesAndBitmap.ImageView.Width = ListView1.TwoLinesAndBitmap.ImageView.Height
ListView1.TwoLinesAndBitmap.ImageView.Gravity = Gravity.CENTER
ListView1.TwoLinesAndBitmap.Label.TextColor = Colors.Black
ListView1.TwoLinesAndBitmap.Label.Left = ListView1.Left
ListView1.TwoLinesAndBitmap.Label.Width = ListView1.Width
ListView1.TwoLinesAndBitmap.Label.Height = ListView1.TwoLinesLayout.ItemHeight/2
ListView1.TwoLinesAndBitmap.Label.Gravity = Gravity.CENTER + Gravity.CENTER_VERTICAL
ListView1.TwoLinesAndBitmap.Label.TextSize = ListView1.TwoLinesAndBitmap.ItemHeight * 170/1000dip
ListView1.TwoLinesAndBitmap.SecondLabel.Left = ListView1.Left
ListView1.TwoLinesAndBitmap.SecondLabel.Width = ListView1.Width
ListView1.TwoLinesAndBitmap.SecondLabel.Height = ListView1.TwoLinesLayout.ItemHeight/2
ListView1.TwoLinesAndBitmap.SecondLabel.Gravity = Gravity.CENTER + Gravity.CENTER_VERTICAL
ListView1.TwoLinesAndBitmap.SecondLabel.TextSize = ListView1.TwoLinesAndBitmap.ItemHeight * 150/1000dip
i try to center all items in center verticaly but as i attach an image blow there is problems in all three devices ( Sony V , Lenovo tablet , AVD ) and none of them load nice
in sony V :
-lable load on top
-SecondLabel load on bottom
- imageview not Center in vertical
in Lenovo Yoga :
-lable load on top
-SecondLabel load right after label on top
- imageview not center vertical
in avd Emulator :
-lable load on top with a little nicer space from top
-SecondLabel on the bottom (0 position) !!
i`m very confused and try to change various options but no luck at all
Here is the screenshot i take of all 3 devices :
http://i58.tinypic.com/650k1u.jpg
Try this replacements and additions;
ListView1.TwoLinesAndBitmap.ImageView.Left = (ListView1.Width - ListView1.TwoLinesAndBitmap.ImageView.Width)/2
ListView1.TwoLinesAndBitmap.Label.Left = 0
ListView1.TwoLinesAndBitmap.SecondLabel.Left = 0
ListView1.TwoLinesAndBitmap.SecondLabel.Top = ListView1.TwoLinesLayout.ItemHeight/2
This is a continuous question of https://stackoverflow.com/a/21074207/3269910
the solution seems fine c0.0.851.315
but the c0.0 values are pointing to 0x0 position of the images
what i want is the image with offset_y . if an offset_y: 20,
ie, i want the same size and part of image, what i am seeing in my page timeline in a api call.
Is it possible to do this ?
Note: if i change c0.0 the zero value to some other then it is pointing to pixels but offset_y is % i think.
Thanks for your help.
I had discussion with Facebook Platform Team;
They are not ready to share the manual calculation to us.
and yes, it is possible to calculate value of c0.XXXX manually using your API offset_y value.
Here is my PHP code.
$fb_page_cover_json = json_decode( file_get_contents( 'https://graph.facebook.com/11111111?fields=cover'));
$fb_cover_image_url = $fb_page_cover_json->cover->source;
$image_info = getimagesize($fb_cover_image_url);
$image_width = $image_info[0];
$image_height = $image_info[1];
echo getTop($fb_page_cover_json->cover->offset_y,$image_width,$image_height);
function getTop($offset_y,$image_width,$image_height) {
$cover_w = 851;
$cover_h = 315;
$img_w = $image_width;
$img_h = $image_height;
$real_img_h = ($cover_w * $img_h / $img_w) - $cover_h;
$result = ($real_img_h * $offset_y / 100 * -1);
return floor($result);
}
The method getTop will return the c0.XXX value.
Hope this helps some one.
At current I'm making a list of images for a banner slider using code as follows:
page.10.marks.topimage = IMAGE
page.10.marks.topimage {
file.import.data = levelmedia: -1, "slide"
file.import = fileadmin/user_upload/
file.import.override.field = media
file.import.current = 1
file.import.listNum = 0
border = 0
file.height = 670
file.width = 1800
altText = Banner
titleText = Banner
wrap = <div id="slides">|
}
page.10.marks.topimage1 = IMAGE
page.10.marks.topimage1 {
file.import.data = levelmedia: -1, "slide"
file.import = fileadmin/user_upload/
file.import.override.field = media
file.import.current = 1
file.import.listNum = 1
border = 0
file.height = 670
file.width = 1800
altText = Banner
titleText = Banner
}
etc...
However, this means, every time the other admins want to add a new slide or remove one from the total count, I have to change this code. Adding the content of the slides is not a problem, they simply upload to user_upload and it pulls 0 to 3 at current. However, they want to be able to upload 5 images and have it show 5 or just 3 and have it show 3 and I need a more dynamic way to implement this. I'm still new to Typo3 (i really don't understand it, php is 10,000X easier!), so if anyone could, please explain to me better than the docs, how subparts work or what my solution might be.
And no I can't just write an extension to do it. Been there and tried that and still can't figure out how to get extensions in without breaking it.
FYI, if you could break it down and help me "like" it, that would be great, because at current, I'd rather they use wordpress or joomla or ANYTHING but this. If you've seen my other questions, then you'll realize, i've had 0 fun working with this cms and mostly because the documentation and/or "help" i've received has been almost completely useless to me. I only mention this so that maybe someone will break this down for me like i break down jquery/php/.net questions for others. It doesn't hurt to be polite and show a nub "step-by-step" instructions!
page.10.marks.topimage = TEXT
page.10.marks.topimage {
# retrieve data
data = levelmedia: -1, "slide"
override.field = media
# we have some filenames in a list, let us split the list
# and create images one by one
# if there are five images selected, the CARRAY "1" will be executed
# five times where current is loaded with only one filename
split {
# the images are separated via ","
token = ,
# you can do funny stuff with options split, f.e. if you want to give first
# and last image a different class... but thats another topic;)
# we just say, render every splitted object via CARRAY "1"
cObjNum = 1
1 {
# just render the single image,
# now there should be one filename in current only
10 = IMAGE
10 {
file.import.wrap = fileadmin/user_upload/|
file.import.current = 1
border = 0
file.height = 670
file.width = 1800
altText = Banner
titleText = Banner
}
}
}
}